Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append data into one table based on Primary Key on another table

Status
Not open for further replies.

cariengon

Technical User
Mar 18, 2002
283
US
I'm importing data into a table, that cannot be a duplicate record and am using a primary key that is made up of 2 fields of the data. The data from the imported table must be divided up between two tables depending on the status type. I created a stand alone table that has all of the primary keys of the two tables. (both tables are identical - one is an archive and one is the live data-main)

How would I set the append query to look at the primary key table to ensure there are no duplicates appended, before finalizing the append to the proper tables?

The way it is set up now is that I import all the data into the main table and run some queries to update some fields based on different criteria. I then choose those that are considered "matched" and put them into an archive (linked) table. Since the append cannot see what is in the archived table when appending, there is a chance that duplication may occur.

Any ideas?

Thanks,
Carie

 
You say that you are importing data into a table that cannot be a duplicate. Do you mean that you have table1 and you are importing into table2 information that cannot be a duplicate of table1 records? Or are you saying that the table you are importing into cannot have duplicate records?

If you want to ensure that you do not import duplicate records, you could import all the records into a table and then run a sql SELECT DISTINCT query against it to weed out the duplicates.

Rene'
 
Hi car,

First write a select query (QueryA) which weeds out the duplicates... use the 'Find Unmatched' query wizard.

This gives you all records that you CAN append safely without duplicates.

Then write the append query to append the QueryA records to your table.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top