?
Solved

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

Posted on 2006-07-12
9
Medium Priority
?
725 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17094722
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 1000 total points
ID: 17094926
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 1000 total points
ID: 17095388
BPeb, shouldn't it be:

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

Flyster
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 5

Expert Comment

by:BPeb
ID: 17095783
Yep, it was the idea that was important! Thanks
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17096123
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
ID: 17099996
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
ID: 17100079
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
ID: 17101071
Anctec - Thanks for the points. BPeb - Glad to share the idea. :-)
0
 
LVL 5

Expert Comment

by:BPeb
ID: 17103075
Me too :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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