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!

Change autonumber field without losing existing data

Status
Not open for further replies.

BofRossClan

Technical User
Mar 26, 2002
39
0
0
US
I am re-designing an invoicing database. Currently the invoice number is in a long-integer field (the information was appended from a table with auto-number). I want to move all the current records into a table where the invoice number is in an auto number field. However, I can't figure out how to do this without it re-numbering all my invoices, and this is not an option.

Has anyone ever had to do this? Please help!


 
You should be able to append the already existing numbers to a table with an autonumber field without losing any values. In fact, this is the method you use if you want to set an autonumber field to a starting value other than 1. I would caution against using autonumber as the source for your invoice numbers. If a user adds a record then deletes it, the autonumber is gone and Access picks up with the next number. In most cases this leave "holes" in the invoice number sequence which is usually unnacceptable.
 
Foodlady,
You will need to change the data type of the field on the new table from Auto-Number to Number,Long Integer. Append the old records to the new table then change the data type back to Auto Number. This will allow you to keep the old numbers. As I said before, I never repeat myself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top