Solved

Format Zip Code Field in Report to remove dash if there is only 5 numbers versus 9

Posted on 2006-07-12
9
668 Views
Last Modified: 2010-03-22
How can I format a zip code field in an access report so if the zip code field only has 5 numbers it will print just the five numbers and not have a dash after the 5 numbers.

For example, on my report the zip code is showing as 12345- and I only want it to show 12345.
0
Comment
Question by:anctech
9 Comments
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
u could try this

REPLACE([zip code],"-","")

put this in your query for the report, instead of just reporting on [zip code]
0
 
LVL 5

Assisted Solution

by:BPeb
BPeb earned 250 total points
Comment Utility
Or put this in your control source for the field:

=IIF(Len([zip code])>6, [zipcode], Right$([zipcode],5))
0
 
LVL 22

Accepted Solution

by:
Flyster earned 250 total points
Comment Utility
BPeb, shouldn't it be:

=IIF(Len([zip code])>6, [zipcode], Left$([zipcode],5))

Flyster
0
 
LVL 5

Expert Comment

by:BPeb
Comment Utility
Yep, it was the idea that was important! Thanks
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 44

Expert Comment

by:GRayL
Comment Utility
My boss used to tell tell me: "That wasn't an idea - that's just something that won't work!  Don't give me ideas - Give me solutions!"  -  never forget it

Ray

0
 
LVL 5

Expert Comment

by:BPeb
Comment Utility
That's great if the boss never wants to know the genisis of an solution.  I've known some like that, but they tend to be the kind that don't want to be bothered by technical details.

Ideas are are the building blocks of solutions.  I'd take a glimpse (clue) of an idea that's fully formed with the assistance of others over having to go figure it out before presenting it.  I think EE is a great place to get ideas to be used dirrectly on a given problem and indirectly on others that might be close.  This process is also called group brainstorming.  Thus I appreciate Flysters correction to the idea.
0
 

Author Comment

by:anctech
Comment Utility
I appreciate everyones help with this.  I am thinking that it would be fair to split out the points on this to both BPeb and to Flyster being that I actually used info from both of their postings.  Thank you both for your help.
0
 
LVL 22

Expert Comment

by:Flyster
Comment Utility
Anctec - Thanks for the points. BPeb - Glad to share the idea. :-)
0
 
LVL 5

Expert Comment

by:BPeb
Comment Utility
Me too :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

744 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

18 Experts available now in Live!

Get 1:1 Help Now