Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

starting point for autonumber

Status
Not open for further replies.

wblue

Technical User
May 25, 2001
131
0
0
US
when setting an autonumbering field as primary key with one integer ecrements, how do you set a starting point other than 1?
 
I'm pretty sure there's a property in the table design view where you can enter the starting number. Same place where you select the size of the field, input masks, etc.

Leslie
 
No, Les, you're thinking of some other database system.

Assuming the table is empty, here's what to do:

First, if the table has ever had any rows in it, delete the rows (if any) and compact your database.

Next, make a copy of the table, saving it as 'Temp'. Open Temp in Design View and change the Autonumber to just Number. Then open it in Datasheet View and enter a number one less than your desired starting number in that field. Enter data into any other fields that are required, and save the record.

Next, create an Append query that copies all fields from Temp to your table, and run it.

Finally, open your table and delete the single row. (You can delete the 'Temp' table and the Append query, too.)

The next record added to your table will have the starting number. Note: DON'T compact your database again before you start adding records to this table.
------------------
Having said all that, I now have to advise you not to do this. You really shouldn't attach any meaning to the value of an Autonumber field. There is no way to guarantee that numbers will be consecutive, and in a multiuser database they may not even be sequential. You shouldn't get any duplicates, but you certainly can get gaps in the numbers.

The Autonumber feature is designed only for uniqueness, not meaning. End users should never even see them.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top