How do I add a leading zero to a zip code field that lost it upon.

G

Guest

How do I add a leading zero back to a Zip Code field that apparently lost the
leading zero upon importing from original Excel file?
 
T

tina

check the field's Data Type. it probably imported as a Number data type, in
which case you'll probably want to change it back to Text. then you can use
an update query to add back the missing zeros, with an IIf() function, such
as

IIf(Len(ZipCode) = 4, "0"+ZipCode, ZipCode)

changing, ZipCode to the actual name of your zip code field.

hth


"Novice Access User in NJ" <Novice Access User in
(e-mail address removed)> wrote in message
news:[email protected]...
 
D

Douglas J. Steele

Safer might be

Right$("00000" & ZipCode, 5)

just in case there are zip codes that start 00 or 000. (Sorry: I'm Canadian,
and don't know what's valid for zip codes)
 
T

tina

you're right, Doug, that's much easier! (i always seem to do things the
hard way! <g>)
 

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