Appending data to table & avoiding duplicates

  • Thread starter Thread starter mikebres
  • Start date Start date
M

mikebres

Hello all. I'm setting up a database that imports a
daily set of data, appends it to a cummulative table for
a total of two weeks worth of data.

I'm trying to figure out a way to check the data for
duplication before it's appended. So I can prevent
someone from importing a previous days set of data.

Does anyone have an idea of how I would do this?

TIA
Mike
 
Mike, the safest way to do this is to import the data into a temp table. You
can then run a series of checks to make sure the data makes sense: types,
ranges, values for foreign keys, etc. Part of the check is to match the data
against existing data. That's just a mater of opening a Recordset consisting
of a query statement that JOINs the new data with the existing data on the
likely matches.
 
Allen,

Okay. I understand the concept, but the specifics still
elude me. If I join the new data to the existing data do
I then test to see if there are any records in the
query? I assume if there are no records then the new
data is unique. If that's what I'm looking for, how do I
do test for that?
Also what happens if I just make the fields in the data
table primary keys to prevent the addition of duplicate
values? Is there a downside to this?

Thanks
Mike
 
I understand the concept, but the specific's still elude
me. I assume if I setup a query with a join between the
new data and the old data, any records in the query would
indicate duplicate data. How do I test for that in my
code?
Also this just occured to me, what if I set the fields in
the old data to primary keys and let Access do the work
for me? Is there a downside to this?
Thanks
Mike
 
Back
Top