Question : Import data from excel then add autonumber field: 90000 rows

I have data in Excel, in 2 tables of about 40,000 and 50,000 rows (due to row limit size). I want these to be transferred to access in 1 table.

I also want the primary key of the new Access table to be an autonumber field starting at 1 (called "Sales ID")
I tried to create a Sales ID field in excel before bringing ht edata in but then found I could not convert the field to autonumber.

In future, more data (about 100-200 new rows each week) will need to be imported.
not sure if this requirement has any bearing on the solution requested above (I cant see how you can import multiple rows from Excel into an existing table and cause the primary key autonumber field to get populated automatically).

The data supplied weekly in excel format will not have the primary key sales ID field in it.

Answer : Import data from excel then add autonumber field: 90000 rows

Rutlandict,

Here are my thoughts.

First, I'm assuming that the fields in all your Excel files are the same (same field names and same number of columns).

Setup Your Table in MS Access:
Step through the Import Wizard to import your first Excel file.  Import the Excel file to a "new" table.  Select the option to "Let Access add primary key".  You can name your new table or let Access use the Excel Sheet name (this is the default).

Once you have successfully imported the first Excel file, you should have a table with an ID field which is an auto-number primary key.  You can go to the Design view of the table and rename the ID field to SalesID.  Now you should be looking at a table that looks like what you had in mind.

Import Your Excel Files:
Next, import the other Excel files.  Import them using the Import Wizard as you did for the first file, but select store data "In an Existing Table" and select your table.  If all the fields names in the Excel file match existing fields in your table, then you should have no problems completing the import of the file.  After the import, open the table and you should see all the new data with a unique SalesID.

Please let me know if this helps.

Mike
Random Solutions  
 
programming4us programming4us