Solved

query to add zeros to a number

Posted on 2012-04-02
5
375 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 74

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 74

Expert Comment

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

713 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