Importing from Excel

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?
 
T

Terry

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
 
J

Jim/Chris

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top