How do I allow a leading zero in an Access number field?


G

George

I have a 5 digit number that may or may not have a leading zero. This is the
key field in the database. I need it to allow and display a leading zero.
 
Ad

Advertisements

B

Beetle

Change it to a text field. Number (integer) data types cannot have leading
zeros.
 
B

BruceM

You can use the Format function, which returns a string. In a query field:

NewField: Format([NumberField],"00000")

In the Control Source of an unbound text box:
= Format([NumberField],"00000")
 
C

Clifford Bass

Hi,

Or, just set the Format property of the text box to 00000.

Clifford Bass

BruceM said:
You can use the Format function, which returns a string. In a query field:

NewField: Format([NumberField],"00000")

In the Control Source of an unbound text box:
= Format([NumberField],"00000")

George said:
I have a 5 digit number that may or may not have a leading zero. This is
the
key field in the database. I need it to allow and display a leading zero.
 
Ad

Advertisements

J

John W. Vinson

I have a 5 digit number that may or may not have a leading zero. This is the
key field in the database. I need it to allow and display a leading zero.
5, 05, 00005 and 000000000000000000000000000005 are *all the same number*, and
they are stored in the same way (binary 00000000 00000000 00000000 00000101 if
it matters).

If you want to store leading zeros and make a distinction between values with
and without leading zeroes then you must store the data in a Text field, not a
Number.
 

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