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

  • Thread starter Novice Access User in NJ
  • Start date
N

Novice Access User in NJ

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
[email protected]> 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>)
 
Top