Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / September 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Novice Access User in NJ - 30 Sep 2004 17:55 GMT
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?
tina - 30 Sep 2004 18:17 GMT
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

> 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?
Douglas J. Steele - 30 Sep 2004 18:41 GMT
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)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

> 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
[quoted text clipped - 10 lines]
> the
> > leading zero upon importing from original Excel file?
tina - 30 Sep 2004 19:11 GMT
you're right, Doug, that's much easier!  (i always seem to do things the
hard way!  <g>)

> Safer might be
>
[quoted text clipped - 26 lines]
> > the
> > > leading zero upon importing from original Excel file?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.