Create number with leading zeroes

bulrush

Registered User.
Local time
Today, 08:28
Joined
Sep 1, 2009
Messages
209
I have a number, say 10000, but I want it to be 6 digits with leading zeroes.
This did not produce an error, but it did not work either. Searching these forums and Access help did not help me.

Code:
dim l as long
l=10000
l=format(l,"000000")
l is still 10000 not 010000.

Thank you.
 
You cannot have a numeric field with leading zeros. If you want to use leading zeros then use the Format(Field,"000000") in a query or on a form to convert it. I assume it is for sorting purposes.

David
 
Nevermind. Format returns a string, not a number. Code should be:
dim l as long
dim s as string
l=10000
s=format(l,"000000")
 

Users who are viewing this thread

Back
Top Bottom