Delete space in text field (1 Viewer)

Ron_dK

Cool bop aficionado
Local time
Today, 14:09
Joined
Sep 5, 2002
Messages
2,141
In my Dbase, I have a table with a text field. Field name is Country
There are over 5000 records in the table and many of these in the Country field start with a space. I would like to get rid of this space as to ensure that all text starts with a character, rather than a space.
How can I achieve this.
 

Ron_dK

Cool bop aficionado
Local time
Today, 14:09
Joined
Sep 5, 2002
Messages
2,141
Just to add to this :

I tried "Expr1: Replace([Country],Chr(32),"")
in a query, which works fine, but all spaces in the text are now deleted.
I only want the first space to be deleted.

Any idea's please .
 

Golfer

Registered User.
Local time
Today, 13:09
Joined
Jul 6, 2005
Messages
64
Although i dont specifically know how to do this in access, i would propably go about it by exporting your table to excel doing a find and replace ( or parse ) on this field and then import the Excel sheet back into access (renaming the original table first)
 

DCrake

Remembered
Local time
Today, 13:09
Joined
Jun 8, 2005
Messages
8,632
Simple Software Solutions

Hi

The easiest way to do this is to use the LTrim() or Trim() function

To updata the field to remove leading spaces....

Create a new query and add the table in question

Drag down the field into the first column in the grid

In the second column enter Exp:Trim([FieldName])

Open the query in datasheet mode

Highlight the second column and press Ctrl+C (Copy)

Highlight the first column and press Ctrl+P (Paste)

Click Yes to the prompt

Close query without saving

Job Done

Code Master::cool:
 

Ron_dK

Cool bop aficionado
Local time
Today, 14:09
Joined
Sep 5, 2002
Messages
2,141
In the second column enter Exp:Trim([FieldName])

Dcrake,

The trim function did the trick. Thanks for that.
As often with these questions, I was searching both in Access help and this forum with the wrong parameters : "delete space" where I better had put in "remove space".
Anyway, thanks for the pointer.
 

Users who are viewing this thread

Top Bottom