Search code examples
ms-access-2003ms-access-2000

Adding characters in string MsAccess 2000


I have table with one field:

Postal
48016350
48016350
48016350
48016350
48016350

I need to add "0" before each record and add "-"(dash) after 5th character in my MsAccess 2000 database.

My goal is:

Postal
04801-6350
04801-6350
04801-6350
04801-6350
04801-6350

Thank you for help.


Solution

  • You can do this with an update query:

    UPDATE table
    SET postal = "0" & Left(postal,4) & "-" & Right(postal,4)
    

    You can paste the SQL into SQL View of the Query Design window. Make sure you make a copy of the table first.