"AutoNumber" again

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know there are a lot threads talked about AutoNumber. I tried to search but cannot find a similiar situation.
I have a table with autonumber as primary key and a form for data input. When something has been typed in the form, Access has got hold of the "autonumber". But, if the user changes the mind the create the record, I found that number is consider used. Any idea that I can release this "unused" number so that the number will not be wasted. Thanks.
 
in order to release - you have to compact database. but this works only for
last unused number(s) (at the end)

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

WC Lo said:
I know there are a lot threads talked about AutoNumber. I tried to search
but cannot find a similiar situation.
I have a table with autonumber as primary key and a form for data input.
When something has been typed in the form, Access has got hold of the
"autonumber". But, if the user changes the mind the create the record, I
found that number is consider used. Any idea that I can release this
"unused" number so that the number will not be wasted. Thanks.
 
WC said:
I know there are a lot threads talked about AutoNumber. I tried to
search but cannot find a similiar situation.
I have a table with autonumber as primary key and a form for data
input. When something has been typed in the form, Access has got
hold of the "autonumber". But, if the user changes the mind the
create the record, I found that number is consider used. Any idea
that I can release this "unused" number so that the number will not
be wasted. Thanks.

If this causes you a problem, then you are likely misusing the
AutoNumber. AutoNumbers are only designed to provide unique numbers not in
any specific order. You can play games (compacting the database) to try and
"fix" this, but you are just using the wrong tool to do the job.

You may need to write your own code to create the numbers you want.
There are several questions you have to ask yourself. The primary one is
"What do you want to do with this number"

For example all you are using it for is to keep track of the number of
records, there are much better ways of doing that depending on how you want
to use that number.

Normally the user should never even see an autonumber.
 
If you don't mind auto-numbering being reset to begn at 1,
you can just go into design mode, delete the autonumber field,
and then re-create it.

The new autonumber field will be ordered consecutively from 1 to
the number of records in the table.

--
---------------------------------------------------------------
Michael J. Strickland
Quality Services (e-mail address removed)
703-560-7380
---------------------------------------------------------------
WC Lo said:
I know there are a lot threads talked about AutoNumber. I tried to search
but cannot find a similiar situation.
I have a table with autonumber as primary key and a form for data input.
When something has been typed in the form, Access has got hold of the
"autonumber". But, if the user changes the mind the create the record, I
found that number is consider used. Any idea that I can release this
"unused" number so that the number will not be wasted. Thanks.
 
Thanks to all. Actually I understand what you guys saying. May be I am not 100% clear how the AutoNumber works. I noticed that my records started from 1 and increment by 1 every time. Until one day when my user was doing data entry, he had input most of the idata but all a sudden he changed the mind to cancel the input. So he closed the form. I noticed that the record had not been inserted to the table but the autonumber had been used
The sequent of the number was 1 .. 2 ... 3 ... 4 ... skip ... 5 ... 6 .... I wonder, in such case, can I tell the autonumber to stop plus one?
 
wc Lo said:
Thanks to all. Actually I understand what you guys saying. May be I am
not 100% clear how the AutoNumber works. I noticed that my records started
from 1 and increment by 1 every time. Until one day when my user was doing
data entry, he had input most of the idata but all a sudden he changed the
mind to cancel the input. So he closed the form. I noticed that the
record had not been inserted to the table but the autonumber had been used.
The sequent of the number was 1 .. 2 ... 3 ... 4 ... skip ... 5 ... 6
..... I wonder, in such case, can I tell the autonumber to stop plus one?

No. If you care about the value in ANY way other than uniqueness, then
don't use an AutoNumber.
 
Back
Top