Formatting Zip Codes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi! I'm trying to format a zip code so that it appears in the report as
12345-6789 if there are 9 digits in the underlying table of as 12345 if the
table only contains the 5 digit zip code. Right now I'm using the following
code which is omitting the dash:[City] & ", " & [State] & " " & Format([Zip
Code],"00000")
Can you help? Thanks.
 
Try this --
IIF(Len([Zip Code])>5, Format([Zip Code],"00000-0000"), Format([Zip Code],
"00000"))
 
Hi! I'm trying to format a zip code so that it appears in the report as
12345-6789 if there are 9 digits in the underlying table of as 12345 if the
table only contains the 5 digit zip code. Right now I'm using the following
code which is omitting the dash:[City] & ", " & [State] & " " & Format([Zip
Code],"00000")
Can you help? Thanks.

The Zips might be 12345-6789 or 12345- or 12345
so...

=[City] & ", " & [State] & IIf(Len([Zip])>6,[Zip],Left([Zip],5))
 
Thanks...works perfectly.

KARL DEWEY said:
Try this --
IIF(Len([Zip Code])>5, Format([Zip Code],"00000-0000"), Format([Zip Code],
"00000"))

--
KARL DEWEY
Build a little - Test a little


JRSNHECI said:
Hi! I'm trying to format a zip code so that it appears in the report as
12345-6789 if there are 9 digits in the underlying table of as 12345 if the
table only contains the 5 digit zip code. Right now I'm using the following
code which is omitting the dash:[City] & ", " & [State] & " " & Format([Zip
Code],"00000")
Can you help? Thanks.
 
Back
Top