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

How to import data to overwrite data in existing table

Status
Not open for further replies.

Swiftraven

Technical User
Oct 29, 2001
28
US
Hi all,
I need to import data into an existing table and have it overwrite the data already in the table with the new data.

The data that is in the current table is autonumbered.

Is there a way to import the data over top of the records already in the table? Can I also have the new data autonumbered from 0 instead of from the number after the last record in the current table? (ie start from numbering from 0 instead of 160, where the last record in the old table was ID 159).

Thanks in advance,
Jason
 
To overwrite existing data, you have to use VBA. You also have to have a unique identifier, so that you can find the appropriate table. Then you use the DAO edit and update actions.

As far as controlling autonumbers is concerned, you dont have that facility. If you need to do this, you have to have a single record table, with a counter in it and increment the counter whenever you add a new record. again, this is a DAO job in Visual Basic.
 
I've done it with macros. You need to create a template of the table, which you can do by copying the structure.
Macro steps:
1. delete table original table
2. copy template to the original table name.

Now, you will have an empty table which will autonumber from 1 again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top