Insert Space

G

Geoff Murley

I have a column which contains Postcodes such as:

CF453UQ

I need to insert a space after the 4th position for all
the postcodes so that my postcode column is updated to
CF45 3UQ for example.

Any help would be appreciated.
 
K

Ken Snell [MVP]

UPDATE MyTableName
SET Postcodes = Left([Postcodes], 4) & " " &
Mid([Postcodes], 5);
 
T

Tim Ferguson

CF453UQ

I need to insert a space after the 4th position for all

Actually, you need to insert a space before the third-from-last. There are
loads of Cardiff postcodes that have a single digit in the first part. Try
this:

NewPostCode = Left(PostCode, Len(PostCode)-3) & " " & _
Right(PostCode, 3)


Hope that helps


Tim F
 
G

Geoff Murley

Thanks very much - that will do nicely.
-----Original Message-----


Actually, you need to insert a space before the third- from-last. There are
loads of Cardiff postcodes that have a single digit in the first part. Try
this:

NewPostCode = Left(PostCode, Len(PostCode)-3) & " " & _
Right(PostCode, 3)


Hope that helps


Tim F

.
 
Top