?
Solved

Compare records in separate tables

Posted on 2011-02-14
3
Medium Priority
?
334 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 1000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 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