Insert a Dash into a Zip Code

D

David

How would you write a query to insert a dash after the 5th
number into a 9 digit zip code? ie xxxxxxxxx to xxxxx-
xxxx?
Some of the records have 5 numbers and some have 9.
This needs to be done at the table level, not the report
level.
 
C

Cheryl Fischer

Some of the records have 5 numbers and some have 9.

Well, that's new information and you will need to test for the length of the
data in your ZipCode field, using the following in the UpDate to row:

Iif(Len(Trim([ZipCode]))=5, [ZipCode], Format([ZipCode],"00000-0000"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top