Solved

Compare records in separate tables

Posted on 2011-02-14
3
332 Views
Last Modified: 2012-05-11
I was so hoping that I could figure this out on my own.... but alas, no such luck. So I turn to the maharishis of code....

I have two tabels: Tbl1, Tbl2
They each have a column containing emails
I want to compare each email in Tbl2 with the emails in Tbl1
If the email in Tbl2 is not present in Tbl1 then I want to add it to Tbl1

I'm working with Access07

As always, thank you for your help and guidance

~worcse
0
Comment
Question by:Worcse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 250 total points
ID: 34890337
Something like:
Insert into tb2 select email from tb1 where email not in (select email from tb2)
0
 
LVL 11

Expert Comment

by:RgGray3
ID: 34890508
Employ an outerjoin between tables where you link the two tables on the email address

Right click on the join line in the query...  and select ALL records from Tb1 and only those in tb2 that match as the join type

in your query you filter the records by Where tb2.Email = Is Null

That will give you the records that exist in 1 and not 2

You can then convert the query into an insert query and insert the records into tb2

(Note...  always a good idea to create the query as a select first  then change it to an append)
0
 

Author Closing Comment

by:Worcse
ID: 34890719
aarontomosky,
With a little tweaking... I was able to get this to work!
Thank you for your help and quick reply.
Regards,
~worcse
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question