Import is appending data to table

  • Thread starter Thread starter Toby
  • Start date Start date
T

Toby

In a similar thread to the one just posted by Roxanna

I want to import an Excel spreadsheet into a table in my
Access DB.

I am using following: DoCmd.TransferSpreadsheet
acImport, 0, "tblSchedule", "C:\mail\in\import.xls", false

This code works but it is appending to the table.

What is the best way to update the table - or would it be
best to delete the old table and then to create a new one
to import tha data into?

If the latter would be most elegant solution, can anyone
help with some code that would do this ?

Thanks

Toby
 
Hi Toby,

Don't delete the table, but delete the records it contains using
something like

CurrentDB.Execute "DELETE FROM tblSchedule", dbFailOnError

Alternatively, consider linking the spreadsheet instead of importing.
 
Back
Top