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.
 
Joined
Feb 26, 2013
Messages
12
Reaction score
0
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.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top