how do I force leading zeros (as in ZIPs) to be displayed in Acce.

G

Guest

How do I force a leading zero in a ZIP code to be displayed in both the table
and form in ACCESS 2003? The table was imported from EXCEL where it was
defined as a ZIP under Special cell formatting.
 
J

Joseph Meehan

Rick said:
Make the field a TEXT field before importing it.

Correct. However if you have it there now you can tell Access to
display it with leading zeros. Keep in mind that no "number" has leading
zeros.
 
F

fredg

How do I force a leading zero in a ZIP code to be displayed in both the table
and form in ACCESS 2003? The table was imported from EXCEL where it was
defined as a ZIP under Special cell formatting.

If the Access field (in the table) is defined as a Number datatype, it
will not store leading zeros ... 02589 is the same number as 2589.

If the Access field is defined as a Text datatype it will store the
leading zeros..

Are they all 5 digit ZIPs?
You can either simply set the format property of the ZIP control (in
your report) to
00000
or explicitly format it within an expression:
=[City] & ", " & [State] & " " & Format([ZIP],"00000")

Or....

Change the field to a Text datatype and run an Update query to
permanently add the leading zero's.
Update YourField Set YourField.ZIP = String(5 - Len([ZIP]),"0") &
[ZIP];
 

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