Access Deleting Unwanted Spaces - Access VBA

Joined
Feb 26, 2013
Messages
12
Reaction score
0
Hey all, I have a variable declared as a string that brings back values based on criteria from a table in access.

For arguments sake the code could be;

PersonsName = "Joe, Bloggs "

Notice the spaces after the surname?

I need to delete all the spaces, bar the first one before the surname.

the variable name could be anything and the number of spaces after the surname will also vary.

I have tried the replace(PersonsName, " ", "") but this deletes all of the spaces including the first one.

Any suggestions?

I appreciate any responses.
 
Again I have managed to sort this using the trim function, this didnt work first time round thats why I went onto replace instead but second time the trim function worked.....
 
Back
Top