Leading zeroes being stripped out of table entries?

G

Guest

Hello, I have a lookup table contains two fields: one for 'labsite number'
and another for 'labsite name'. The 'labsite numbers' all start w/ 2 zeroes
(e.g., '001', '002', etc.). I have 'labsite numbers' defined in my table as
a Number- Long Integer, w/ an Input Mask of '999'. When I enter in '001',
and tab over to the next field, then Access changes it to '1'.

I need the leading zeroes to stay, but Access is not letting them. How do I
do this?

Thx,
 
J

Joseph Meehan

Pat said:
Hello, I have a lookup table contains two fields: one for 'labsite
number' and another for 'labsite name'. The 'labsite numbers' all
start w/ 2 zeroes (e.g., '001', '002', etc.). I have 'labsite
numbers' defined in my table as a Number- Long Integer, w/ an Input
Mask of '999'. When I enter in '001', and tab over to the next
field, then Access changes it to '1'.

I need the leading zeroes to stay, but Access is not letting them.
How do I do this?

Thx,

Numbers including Integers do not have leading zeros.

However there are two way you can display numbers with leading zeros in
Access

If they will always have the same number of digits Like 001, 010, 100,
005 etc, then you can format the display of the numbers to show leading
zeros use 000 for three digits with leading zeros for numbers less than
100.

This will not help if you want numbers like 001, 002, 0025, 00159 etc.
For that you will need to change the field type to text, not numbers, of
course then you ca no longer perform calculations as the sum of the
characters 2 and 2 do not equal 4.
 
J

John Vinson

Hello, I have a lookup table contains two fields: one for 'labsite number'
and another for 'labsite name'. The 'labsite numbers' all start w/ 2 zeroes
(e.g., '001', '002', etc.). I have 'labsite numbers' defined in my table as
a Number- Long Integer, w/ an Input Mask of '999'. When I enter in '001',
and tab over to the next field, then Access changes it to '1'.

I need the leading zeroes to stay, but Access is not letting them. How do I
do this?

Use a Text type field.

The number 1 and the number 0000000001 and the number 001 are THE SAME
NUMBER.

The text strings "1" and " 1" and "001" are three different text
strings.

If you won't be adding, subtracting, dividing or multiplying your
Labsite Numbers (which I suspect you won't!) then they aren't really
"numbers" - they are identifiers; and if these identifiers happen to
consist of numeric characters, just use a Text field with an input
mask of

000

to require that only digits can be stored in the text field.

John W. Vinson[MVP]
 

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