Why does ZIP code lose format

G

Guest

I am using WIN XP Pro and Office 2003

In a table, I have a field for Zip codes, input mask places a dash between
1st 5 digits and last 4. It displays correctly except when I put the field
in a new defined field in a query it returns the Zip code without the dash.

Is there a way to keep the dash?

Thanks
 
D

Dirk Goldgar

shep said:
I am using WIN XP Pro and Office 2003

In a table, I have a field for Zip codes, input mask places a dash
between 1st 5 digits and last 4. It displays correctly except when I
put the field in a new defined field in a query it returns the Zip
code without the dash.

Is there a way to keep the dash?

The input mask only saves the dash if you set an extra flag in the mask
to tell it to. If you really want the dash to be stored in the field --
I wouldn't, since it's always implied -- then change the input mask to
something like this:

00000-9999;0;_

The 0 after the first semicolon tells access to store the dash in the
field.
 
G

Guest

Thank you

I found Q197588, which provides a way to get the dash with an IIF input in
the New Defined field -- works great. Your comments spurred me to find it.

Thanks Again
 
G

Guest

Open the table in design view, then set the data-type to Text and select a
zip code input mask from the elipses "..." build button. Be sure to tell the
build wizard to keep the place holders.
 
A

Arvin Meyer [MVP]

An input mask correctly forms new data. An input mask won't change existing
data. You can format existing data to show a dash, by using the format
property (check help on formatting) or you can use an update query to change
the existing data to include a dash. If all of them have 9 characters just
use:

UPDATE tblMyData SET tblMyData.MyField = Left([MyField ],5) & "-" &
Right([MyField ],4);

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
G

Guest

Arvin - I know it's taken me a while to reply...priorities changed, etc. But
I finally got back to working on my database, and wanted to thank you for
your help. I now have zip codes that look like zip codes, dash and all!

Thanks again,

Richard

Arvin Meyer said:
An input mask correctly forms new data. An input mask won't change existing
data. You can format existing data to show a dash, by using the format
property (check help on formatting) or you can use an update query to change
the existing data to include a dash. If all of them have 9 characters just
use:

UPDATE tblMyData SET tblMyData.MyField = Left([MyField ],5) & "-" &
Right([MyField ],4);

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Richard Borgner said:
I've done that, but my documents still don't contain a dash....very frustrating
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top