How To Check Two Other Tables Before Appending Records?

CiViCChiC79

New Member
Joined
Oct 7, 2015
Messages
4
Hi There!

I am having trouble finding an answer to my question. I know how to append records to a table without getting a key violation. In this case I need to check TWO other tables for matching keys before appending.

I tried:
Criteria: Not In (SELECT tblPLDenialReview1_Initial.AppNumber FROM tblPLDenialReview1_Initial) AND Not In (SELECT tblPLDenialsQueue_Tier001.AppNumber FROM tblPLDenialsQueue_Tier001)

But that only allowed 3 records out of 15,000 to post. If I use OR in the above statement, of course it works just like the criteria isn't specified at all. A given record will never exist in both tables at the same time.

Any help you can offer is greatly appreciated!!

Thanks, CiViCChiC79 :)
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Your criteria looks correct. To check how many wouldn't post, you could try this instead:

In (SELECT tblPLDenialReview1_Initial.AppNumber FROM tblPLDenialReview1_Initial) OR In (SELECT tblPLDenialsQueue_Tier001.AppNumber FROM tblPLDenialsQueue_Tier001)

By chance do you have any other criteria in your query?
 
Upvote 0
Hi Russell,

Thanks, I will try that. I only have one other field in this query that I am checking. It is a numeric category field 1 through 5.

Regards, CiViCChiC79 :)
 
Upvote 0
Actually, I realized I need to check each and every table for Tiers 1 through 5 and the final resting place (tblPLDenialReview1_Initial) because if a Tier rating changes and the record is still in one of the "Tiered Buckets", it would still import that record. My users don't ever want to see a duplicate application ever. So I have decided to just create another table that houses just the primary key for all Tiers and run my Not In criteria against that. Thanks so much for your help!!
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top