[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Count Leading Zero

Posted on 2004-10-15
Medium Priority
Last Modified: 2012-06-27
I'm using zip codes to sort and compile information and I have a query where I run an inventory of people in a 3 digit zip code range like this

Left([qryLastMail]![zip],3) AS 3DigZip

The problem I'm having is in the zip codes where there is a leading zero like in MA 01001 the query returns 100 instead of the 010. How can I get it to count the leading zero. The field is already formatted with 5 digits and when I do the query to show all five it returns the numbers with the leading zero just fine.
Question by:athomas79
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
  • 3

Expert Comment

ID: 12323106
left(cstr([qrylastmail]![zip],3) as 3digzip

Accepted Solution

mcorrente earned 2000 total points
ID: 12323177
if not, try left(format([qrylastmail]![zip],"00000"), 3) as 3digzip

Author Comment

ID: 12323385
The changing it to a string didn't work, but formatting it again in the query before the taking left three digits worked great, Thanks!

Expert Comment

ID: 12323406
no problem.

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

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…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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