autonumber

  • Thread starter ielmrani via AccessMonster.com
  • Start date
I

ielmrani via AccessMonster.com

I have a table with a primary id, data type is autonumber. My issue is: the
table had some data in it. I deleted the data. Now I am trying to enter new
data, the autonumber is not starting from 1, 2, etc...it starts at the last
number before the data got deleted (19,20,etc). How can I make fix it. I
hope I am not confusing you.
Thanks
 
M

missinglinq via AccessMonster.com

1) Delete the data from your current database.
2) Create a new blank database
3) Import all controls from old database
4) The Autonumber of your table will now be reset at 1

I have a table with a primary id, data type is autonumber. My issue is: the
table had some data in it. I deleted the data. Now I am trying to enter new
data, the autonumber is not starting from 1, 2, etc...it starts at the last
number before the data got deleted (19,20,etc). How can I make fix it. I
hope I am not confusing you.
Thanks

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
D

Douglas J. Steele

That's exactly how Autonumbers are meant to behave.

Autonumbers exist for one purpose only: to provide a (practically
guaranteed) unique value that can be used as a primary key. That purpose is
fulfilled by 19, 20, 22 just as well as by 1, 2, 3. It's actually considered
normal not to even show the value of the Autonumber field to the users.

If you're trying to assign some meaning to the value of the Autonumber
field, then you likely shouldn't be using Autonumbers.
 
I

ielmrani via AccessMonster.com

Worked. Thank you very much.
1) Delete the data from your current database.
2) Create a new blank database
3) Import all controls from old database
4) The Autonumber of your table will now be reset at 1
 
K

Keith Wilby

ielmrani via AccessMonster.com said:
Worked. Thank you very much.

It worked but you're using AutoNumber for the wrong purpose. AutoNumber is
intended for indexing purposes internal to Access. If you want unique and
sequential numbering, try this as the default value of a text box bound to a
numeric field:

Nz(DMax("MyField","MyTable"))+1

where MyField is the name of your field and MyTable is the name of the table
containing the field.

Keith.
www.keithwilby.com
 
I

ielmrani via AccessMonster.com

thank you guys for the info.
That's exactly how Autonumbers are meant to behave.

Autonumbers exist for one purpose only: to provide a (practically
guaranteed) unique value that can be used as a primary key. That purpose is
fulfilled by 19, 20, 22 just as well as by 1, 2, 3. It's actually considered
normal not to even show the value of the Autonumber field to the users.

If you're trying to assign some meaning to the value of the Autonumber
field, then you likely shouldn't be using Autonumbers.
I have a table with a primary id, data type is autonumber. My issue is:
the
[quoted text clipped - 5 lines]
hope I am not confusing you.
Thanks
 

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