Importing from Excel

  • Thread starter Thread starter Chantal
  • Start date Start date
C

Chantal

I have set a macro to allow importing from a
predetermined file name-- C:\New_leads.xls. The user
will always import from the same file name. This works
but How to I prevent multiple imports on the same exact
file creating duplicate rows?
 
Chantal,

If the source spreadsheet has a unique identifying column
you can index that field in your destination table not
allowing duplicates. Any additional imports of this
spreadsheet would complete with errors. Key violation type
errors and the data would not be added to your table (it
would wind up in an import errors table). Alternatively if
you only want this data in the table you could clear the
table prior to the import (run a delete query prior to the
import). This way the import would run but only populate
an empty table thus only having the data once.

HTH

Terry
 
After a successfull import rename the Excel file
to "Filename_Processed_todaysdatetime". The next time it
runs will error out. You can trap for that err also.

Jim
 
Back
Top