I am trying to get access to display leading zeros and auto numbe

D

Donna

we use a sequential number system that begins new each month but we need it
to hold 4 places 0001, 0002. etc. I would like to know if Access will do
this.
 
D

Dirk Goldgar

Donna said:
we use a sequential number system that begins new each month but we need
it
to hold 4 places 0001, 0002. etc. I would like to know if Access will do
this.


Yes, but ...

You can't use the built-in autonumber field to do what you want. Therefore
you'll need some VBA code, or maybe a macro, to generate each new number.
Assuming what you mean is that you need the numbers for each month to begin
at 0001 and go on sequentially up to a maximum of 9999, that means the
process of generating a new number will have to first lookup the highest
number already assigned for this month, then add 1 to it -- and raise some
sort of error if the the new number exceeds 9999. If there is no existing
number assigned to this month, it should generate the number 0001. This is
quite straightforward, when sufficient details are known about the tables
and fields involved.

It isn't clear to me whether or not you really need to store these numbers
as a string, in which case you need to convert between a true number (that
you can add 1 to) and a formatted string composed of four numeric digits.
However, that is easily handled by the Format() function.
 
R

Risse

Donna said:
we use a sequential number system that begins new each month but we need
it
to hold 4 places 0001, 0002. etc. I would like to know if Access will do
this.
 

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