Add leading zeros to #'s to make all in field same length

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to format/code fields so that all of the numbers in that field
are the same length?

Example:
(What I have) (What I want)
Field 1 Field 1
1 001
2 002
19 019
120 120

These #'s will eventually be concatinated with others to make a type of
"serial code" for supplies, and I want all the new serial codes to be the
same length. I know the number will never be longer than 3 digits, so I
don't need to look for the largest one to base the formatting on.

Thanks for any help.
 
Set the Format property of the text box on your form/report to:
000

For concatenation, you might use the Format function, e.g.:
=Format([Field1], "000") & [Field2]
 
This worked out great! Thanks!!

Allen Browne said:
Set the Format property of the text box on your form/report to:
000

For concatenation, you might use the Format function, e.g.:
=Format([Field1], "000") & [Field2]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tammi V said:
Is there a way to format/code fields so that all of the numbers in that
field
are the same length?

Example:
(What I have) (What I want)
Field 1 Field 1
1 001
2 002
19 019
120 120

These #'s will eventually be concatinated with others to make a type of
"serial code" for supplies, and I want all the new serial codes to be the
same length. I know the number will never be longer than 3 digits, so I
don't need to look for the largest one to base the formatting on.

Thanks for any help.
 
Back
Top