Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 402
  • Last Modified:

query to add zeros to a number

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
smurfer69
Asked:
smurfer69
1 Solution
 
JestersGrindCommented:
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
 
sdstuberCommented:
right('00000000' + your_number,8)
0
 
mbizupCommented:
In Your query

Format (yourfield, "00000000")
0
 
IrogSintaCommented:
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
 
sdstuberCommented:
ha, that's even nicer  :)
0

Featured Post

Industry Leaders: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now