Insert Space

  • Thread starter Thread starter Geoff Murley
  • Start date Start date
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.
 
UPDATE MyTableName
SET Postcodes = Left([Postcodes], 4) & " " &
Mid([Postcodes], 5);
 
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
 
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

.
 
Back
Top