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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumber Values

Status
Not open for further replies.

kilt

Technical User
Nov 12, 2002
52
0
0
GB
Is it possible to start an autonumber value from one that is below the current values stored in the autonumber field.

I have ids from 1000-20000 and also some archived data that has ids like 93839393. I want to know if it is possible to start the next autonumber value at 20001 and not 93839394.

Thanks in advance for any advice.
 
if you want to specify how your autonumber starts you can do the following.

create a table with 1 field named "ID" save it and add a record say the number 1000..

then create an append query and append that table to your other table where you want to specify what number your autonumber starts. after that your autonumber will start at 1000 instead of 1.

 
This will work so long as you don't also have a record with a higher value, say 5000.

The table would then start at 5001 instead of 1001.

Any other ideas!
 
you can start it at any number you want..
but I think you must start with a clean new table to make this happen. create a new table as I said and then import your records leaving out your old autonumber.

 
No one has really answered the question. You can force autonums to start wherever you want and number them sequentially from there (assuming you are not using the random option), as explained, but you can't insert a number below any one that is already there. You can't set the value of an individual autonum column.

Whenever people ask this question, I always want to know, why do you care what the value of the Autonum column is? Autonums have only one useful, guaranteed property: uniqueness within a table. If you are using them for primary keys(PK), then you don't have a useful or valid PK (find Fabian Pascal, Codd, or Date and see what they have to say about PK's). If you are using it for part numbers, etc., you are using them wrong. They are only good for one thing: as a short-hand for the real PK, useful when the real PK is several columns (and this is technically a violation of the Relational Model, but as a practical matter, it greatly simplifies Joins and Where clauses). When used like this, you never care about what the value is.

Peleg
PelegNOSPAM@PStrauss.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top