Leading zero's in a field

G

Guest

How do I set up a field to accept a certain number of digits, for example
seven, and to display leading zeros for any entry that is not at least the
maximum number. In this case seven is the maximum I want for this field.

Display 123 as 0000123

Thanks.
 
G

Guest

I tried that before. This does not display leadin zeros. If I enter 123 only
123 populate the field not 0000123 which is what I was looking for.

Any suggestions?
 
R

Rick Brandt

matt22 said:
I tried that before. This does not display leadin zeros. If I enter
123 only 123 populate the field not 0000123 which is what I was
looking for.

Any suggestions?

It will display leading zeros until you put your cursor into the field or
control. Then it reverts to what is actually stored to make editing easier.
 
J

Jeff Boyce

Matt

What is stored, and what is displayed, are two different things.

Are you working directly in the table? If so, consider using Access forms
instead.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Yes, I am working directly in the table in datasheet view. If I set the
format to 0000000 the table displays the numbers as entered, not with leading
zeros. When I run a select query on the table the numbers are displayed as
entered, not with leading zeros.
 
R

Rick Brandt

matt22 said:
Yes, I am working directly in the table in datasheet view. If I set
the format to 0000000 the table displays the numbers as entered, not
with leading zeros. When I run a select query on the table the
numbers are displayed as entered, not with leading zeros.

Formatting is not inherited. Even if you saw the formatting you wanted in
the table you would have to set the same formatting on the field of your
query and then again in any form or report used by the query.

In your table are you sure that the formatting is not working when your
cursor is NOT in that field? If so then you must have set it incorrectly.
 

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