Removing Spaces from a Field

BrianFawcett

Registered User.
Local time
, 16:13
Joined
May 3, 2010
Messages
63
I have a database which is being passed records from another database. The Reference number I am being given has a number of spaces in the value, i.e. - "B25601 - 111128 - 1".

I would like to remove the spaces so the field is "B25601-111128-1".

I know TRIM can be used to remove leading and trailing spaces, can it also be used to remove them from the middle of a string?
 
Hi,

Some more detail on the Replace() function:

This should do the trick:

Replace("B25601 - 111128 - 1"," ","")

If the string is in a variable strReferenceNumber, then this should work:

strReferenceNumber = Replace(strReferenceNumber," ","")

Note that there's a space between the first set of quotes, but no space in the second set.

Good Luck!
 

Users who are viewing this thread

Back
Top Bottom