I am converting an old DOS database to Access 2010. The old database has a primary key which is a five digit number. When I imported this into a new table from an Excel sheet, I am not able to use these numbers as a primary key. How can I do this? And then, once I can (if I can) how can I now be sure that the numbers will continue to be sequential from the last five digit number in the new primary key? Also, let's say that the last primary number is 15001 and for some reason I want to make the next new number start at 15101, how can I do this?
Importing primary key numbers from an old database
Collapse
X
-
Tags: None
-
These numbers are the "client numbers" that we have been using for years. To have to change them would be a problem. Thus I would like to know how to subsequently sequence them using them as the primary numbers. Also,due to some particular quirk in the way we used to enter new clients into our database (using DataEaste for DOS) we were always able to change the next starting number and just say sequence from #####. Is this possible in Access 2010? Thanks.Comment
-
importing primar key numbers from old database
I figured it out. After importing all the old data from the old database, create a worksheet in Excel,and make the column heading the same name as the primary key in the database you want to update. Then enter the next number you want to use in the Excel worksheet, save the worksheet, then run a import data from Excel as an append records to a copy of the table and you are set. At least this works so far in testing.Comment
-
If your requirement is to have specific numbers in this field then using an AutoNumber key is definitely not a good idea. PKs do not need to be assigned automatically. You should be using a form to control data entry (whether via the form or even if by importing a new batch of data). You can have a TextBox control on your form that you can use to ensure new numbers are created starting from a particular point. Otherwise, the next number can easily be worked out by using a simple DLookup() call on the table.Comment
Comment