Solved

query to add zeros to a number

Posted on 2012-04-02
5
341 Views
Last Modified: 2012-06-27
I have a list of ID numbers, what I need to do is add zeros to the front of the number for every number that is less than 8 digits.  for example 123456 should be 00123456
0
Comment
Question by:smurfer69
5 Comments
 
LVL 21

Expert Comment

by:JestersGrind
ID: 37797403
Convert it to a string.  Concatenate 7 zeros on to the left of the string.  Trim the string to only use the right 8 characters.

Greg
0
 
LVL 73

Expert Comment

by:sdstuber
ID: 37797407
right('00000000' + your_number,8)
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37797408
In Your query

Format (yourfield, "00000000")
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 37797410
You could try Format(fieldNameForIDnumbers,"00000000").  Now this will not update the table itself, it will just show you the ID numbers with 8 digits.
0
 
LVL 73

Expert Comment

by:sdstuber
ID: 37797411
ha, that's even nicer  :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

708 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

17 Experts available now in Live!

Get 1:1 Help Now