Solved

Preserving Zip Code Formats

Posted on 2014-01-05
11
388 Views
Last Modified: 2014-01-05
I have a file with USA zips codes in the 5 digit style (07897) and the 5 digit+4 style (07897-0875).  How do I format a table so it doesn't drop the leading zeros?

Also, will this format setting also allow non-USA zip codes with totally different styles in the same field (such as international zip codes with letters and more or less than 5 digits).
0
Comment
Question by:daisypetals313
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39758279
The Data Type of the zip code field should be set to Text and its size should be 10.
0
 

Author Comment

by:daisypetals313
ID: 39758287
This didn't work.  Zeros dropped.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39758291
How are you entering the zip codes?
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 61

Expert Comment

by:mbizup
ID: 39758292
Ron is correct.

If you are using best practices with a split database, be sure to relink the back-end tables for that change to actually take effect in the front-end.
0
 

Author Comment

by:daisypetals313
ID: 39758314
Hi, I am not entering manually but rather importing an file.  I'm not sure what split databases means. I'm not sure if my file is that detailed.  I am starting with a blank database and importing an Excel file and the zeros are being dropped.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39758327
Excel is probably dropping the zeros.  If you declare the Excel column to be a number and then use formatting to keep leading zeros, it will still drop them when you export it.  Zip codes need to be text fields.  Phone numbers do too.
0
 

Author Comment

by:daisypetals313
ID: 39758328
I set the field in Excel to Zip code format so it has all the zips correctly.  It is when I bring them into Access that they disappear.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39758331
Try linking to, rather than importing your excel file.

Set up a table, if you havent already with a TEXT field for the Zip code as Ron suggested, and the same field names as in your Excel file

Then run an INSERT query to get the data into your Access table;

INSERT INTO YourAccessTable SELECT * FROM YourLinkedExcelFile
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39758356
Are you importing them into Char fields in Access?  If you bring them into numeric fields in Access, that too will strip leading zeros.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39758361
Doing a direct copy and paste from Excel into Access should keep the formatting.  Try that out.
0
 

Author Closing Comment

by:daisypetals313
ID: 39758373
OK, I have to accept this as a partial solution because it definiately helped get on the right track. The thing that made this work was something I have never tried before and this is setting the Zip code field into two different formats in Excel.  So I did Zip for the five digit zip codes and text for everything else.  Access marked the field as Text.  I don't exactly why this worked by I am so happy to have this now.  Thanks everyone!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Programmer 14 46
Macro to import XML in Access 2013 2 33
Run SQL Server Proc from Access 11 27
Microsoft Access - Stopping Control - (minus) 4 27
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now