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
smurfer69Asked:
Who is Participating?
 
IrogSintaConnect With a Mentor Commented:
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
 
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
 
sdstuberCommented:
ha, that's even nicer  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.