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 can I overwrite tables using import?

Status
Not open for further replies.

Inky2201

Technical User
Jan 15, 2005
26
GB
Hello,
I want to be able to import tables from an external Access database into another copy of the same database and contains the same tables. When I do this it creates another copy of the relevant tables e.g. Table, Table1, Table2 etc. How can I import the tables and overwrite the originals instead of creating new?
Look forward to hearing from you.
Regards
Inky
 
One way: Delete the original table or change the name.

You can do it programatically with VBA or link and run update queries or ...

If you are replacing the entire table each time, do the delete / change name, then import.

Be sure to compact and repair if you are doing this often.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
If it helps, here is the code which you can use in VBA to delete a table:
Code:
DoCmd.SetWarnings False
DoCmd.DeleteObject acTable, "tblYourTableName"
DoCmd.SetWarnings True
You can use this e.g. in the On_Click event of a button on a form, to delete the previous version of a table before you import data into a new version.

The DoCmd.SetWarnings False command, suppresses the Access warning messages which you would otherwise see before the table is deleted, or if there is no table to delete.

I hope that this helps.

Bob Stubbs
 
Thanks both of you for your comments.
I will give it a try.
Regards
I
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top