473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Leading Zeroes in ZIP Code

Newbie question, here.

I have a database that frequently imports ZIP code data that
frequently needs cleaning:

12365
6487
64684-3543
3213-6546
I.e. missing leading zeroes, five digit vs nine digit ZIPs, etc.

How would I format the "Update To" command to: 1) restore leading
zeroes to four and eight digit zips and 2) standardize all ZIPs to
five digits??

Thanks!
Jul 25 '08 #1
2 2800
On Fri, 25 Jul 2008 06:41:57 -0700 (PDT), DanCole42
<da*******@gmail.comwrote:

First off you need a text field.
Then make the first pass and strip off anything starting with "-". You
could do that with a combination of Left$ and InStr.
Then make a second pass and add leading zeros. You could do that with
Format or with Len.

Give it a try.

-Tom.
Microsoft Access MVP
>Newbie question, here.

I have a database that frequently imports ZIP code data that
frequently needs cleaning:

12365
6487
64684-3543
3213-6546
I.e. missing leading zeroes, five digit vs nine digit ZIPs, etc.

How would I format the "Update To" command to: 1) restore leading
zeroes to four and eight digit zips and 2) standardize all ZIPs to
five digits??

Thanks!
Jul 25 '08 #2
iif(instr(1,[ZIP],"-")=0,format([ZIP],"00000"),format(left([ZIP],instr(1,[ZI
P],"-")-1),"00000"))

"DanCole42" <da*******@gmail.comwrote in message
news:5d**********************************@k36g2000 pri.googlegroups.com...
Newbie question, here.

I have a database that frequently imports ZIP code data that
frequently needs cleaning:

12365
6487
64684-3543
3213-6546
I.e. missing leading zeroes, five digit vs nine digit ZIPs, etc.

How would I format the "Update To" command to: 1) restore leading
zeroes to four and eight digit zips and 2) standardize all ZIPs to
five digits??

Thanks!

Jul 25 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: david | last post by:
Hi, I have an application as follows: MySQL database Back-Eend linked to MS Access Front-End and ASP Web Application. I require users to enter Serial Numbers such as: 0105123567 (10...
8
by: TheTeapot | last post by:
Hi all, Here's a puzzle: // Say I have an array of numbers set up like so: $arr = array(15,16,17,100,121,1000); // How can I create a function so that I can use it like so:...
1
by: Jean-michel | last post by:
I need to convert a decimal field to char() but also trim the leading zeroes. Any idea? I could not find any function to do that.
1
by: Mike P | last post by:
I'm trying to write the contents of a csv file to a table, but I am having problems with fields with leading zeroes. Whenever I save as csv I lose the leading zeroes. Does anybody know how to...
24
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I see in javascript if a web browser accepts cookies?...
2
by: tomlebold | last post by:
How do you remove leading zeroes in a column? Update 0000123456 to 123456
8
by: stainless | last post by:
Is it possible, using the ToString function, to take an integer and conver to a string of fiexd width with the leading spaces padded with zeroes. e.g. integer 123 converted to a string of length...
9
by: jbaranski | last post by:
Access 2003 on XP pro machine... i'm running a crosstab query and an export to a 3rd party company showing different benefit plans for employees; specifically dental, vision and medical pulling...
9
by: marcelo27 | last post by:
I need to add leading zeroes to an input box. For example, the user enters "2" , I need to convert to a three digit number eg."002". If the user enters "23", I need to convert to "023" If the user...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.