View Full Version : Need to remove spaces from field in table


davidg47
09-28-2006, 01:26 PM
I have a table that for some reason when I imported the data, placed some spaces before about 75% of the numbers in only one column. I need these numbers to be exactly the same as in another table because I use this number to compare to records and import other data depending on the corresponding numbers.

I tried doing a find and replace, but for some reason it doesn't find the spaces to replace. If I type in the space and the number, then in the replace with type only the number, it works. But I cannot do that since there are literally 10's of thousands of different numbers.

Someone mentioned a "LTRIM" command. Does this work within Access and if so, how does it work?

Thanks,
David

RuralGuy
09-28-2006, 01:35 PM
Use an UPDATE query
"UPDATE YourTableName SET YourField = Trim([YourField]);"

Will remove leading and trailing spaces.

KeithG
09-28-2006, 01:46 PM
The Trim function will remove any blank characters from the begining or end of your string.

davidg47
09-29-2006, 08:45 AM
Worked perfect guys!!! Thanks!!! Actually I only had to use the "ltrim" command to move the numbers to the left justify position.