By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

append query - nonduplicate records

P: 78
OK, I am pulling my hair out on this one. It seems like it should be so simple and I cannot seem to find the answer.

I am using Access 2000 on Windows 2000.

I have two tables set up. Table One is updated Daily, Table Two is going to keep a running tally of Data.

What I need to do is add records form Table One into Table Two. However, I only want to add records that do not exist.

Here is the tricky part. The data in Table One is not identical to Table Two. I need to have it look at 6 columns in Table One and the same in Table Two. If they are Different (all six fields) then Add the record to Table Two.

I cannot find the correct sequence to write to make this happen.

I have tried playing with a regular query to show me the records that do not match(non-duplicate). I can have it show me all files that do, but cannot figure out how to show records that do not match.

The Matching fields are all text fields. Some have numbers, but because of the information they need to saved as text.

Any help is greatly appreciated. Any questions about the information please do not hesitate to ask. Thank you in advance for your help.

Nick
Nov 26 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,287
You need to use the EXISTS SQL condition, or the NOT EXISTS actually. There are some examples here:
SQL: EXISTS Condition

So something like

SELECT * FROM Table1 WHERE NOT EXISTS _
(SELECT Column1, Column2, Column3, Column4, Column5, Column6 _
FROM Table2 Where _
Table2.column1 = Table1.column1 AND Table2.column2 = Table1.column2 AND Table2.column3 = Table1.column3 AND Table2.column4 = Table1.column AND Table2.column5 = Table1.column5 AND Table2.column6 = Table1.column6)
Nov 26 '08 #2

P: 78
Thank you for that. That was exactly what I needed. I never new about "Exists" statement. I still have lots to learn!! Thank you for your help. Sorry for the delayed response. Off work for the weekend.
Dec 1 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.