Adding Leading Zeros to table field data

G

Guest

I need to display leading zeros to data entered to a number field in a table.

Is there a format I can set in the field properties to handle this?

Or should I set this somehow with the query used that is used by the form to
enter the data into the table?

Thanks for your help!
 
F

fredg

I need to display leading zeros to data entered to a number field in a table.

Is there a format I can set in the field properties to handle this?

Or should I set this somehow with the query used that is used by the form to
enter the data into the table?

Thanks for your help!

Setting the format property of the field to, for example:
00000000
will display 123 as 00000123

You really should not be looking at any data in the table.
Tables are for data storage, not viewing.
Use a form.
Format the control on the form as above.
 
J

John Vinson

I need to display leading zeros to data entered to a number field in a table.

Is there a format I can set in the field properties to handle this?

Yes; if you set the Format of a field to

"000000"

all numbers will display with six digits, including leading zeros.

However - 13 and 013 and 000013 are THE SAME NUMBER. If you're using
this field for identifiers (ZIP codes, part numbers, etc.) you should
probably use a Text datatype instead of any sort of Number.
enter the data into the table?

You can do that instead, or in addition to, the table field format.
Just set the Format property of the form or report textbox. In any
case, the format does not change what is stored, just how it's
displayed.

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