Auto Delete imported duplicate records

  • Thread starter BTU_needs_assistance_43
  • Start date
B

BTU_needs_assistance_43

I've been searching and found a number of ways to manually delete duplicates
at any given time, but the way my code records data so frequently I would
like to be able to have it automatically detect and delete any records its
importing that have already been imported OR to just not import the records
that are duplicates. My program imports excel files according to recently
added files because some files I've already imported may get updated with
more recent data added onto the already existing data. How can I make my
program detect or check that the file I'm uploading has been imported before
and not import or record duplicate data?
 
D

Dale_Fye via AccessMonster.com

As I mentioned yesterday, in response to another one of your posts.

One way to do this would be to record the filename and date of the file in
your table. A more efficient way to do this would be to add a table
(tbl_Import) to your database which would contain fields like ImportID,
Filename, FileDate, FileSize, DateImported. As you read a file, you would
update this table and record the ImportID. Then, in the table you are
actually storing the data in, you could add the ImportID field, and update it
along with all of the other information you are pulling from your Excel
spreadsheet.

Then, before importing a file you could check in tbl_Import to see whether
that file has already been loaded, and if so, identify whether the FileDate
(I would actually store the last modified date and time) is the same as the
file you are planning on importing. If the file name, FileDate and FileSize
are all the same, you can assume that nothing has changed. If something has
changed, I think your best bet (based on what you have told us) will be to
delete records from the main table that are mapped to the appropriate
Import_ID, and then just Append all of the new records with a new Import_ID.

HTH
Dale
 

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