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

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.
 
A

Allen Browne

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]
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top