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
Solved

Access Append Table

Posted on 2012-12-28
5
460 Views
Last Modified: 2012-12-28
I have two access 2007 tables. I would like to use an  append query that only appends records from table1 to table two (append to table) where the SSN and the Consult Date fields are not already in table two (append to table). Any thoughts -- Thanks
0
Comment
Question by:shieldsco
5 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38727962
Please try to post a sample database and present the *exact* output you need, based on the sample data.

It is not clear if this means the field itself is not present or the field "value" is not present
...etc
<the SSN and the Consult Date fields are not already in table two (append to table)>

JeffCoachman
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38727970
The general syntax would be something like:

INSERT INTO Table2 (field1, field2, field3)
SELECT T1.Field1, T1.Field2, T1.Field3
FROM Table1 as T1
LEFT JOIN Table2 as T2
ON T1.SSN = T2.SSN and T1.[ConsultDate] = T2.[ConsultDate]
WHERE T2.SSN IS NULL

Basically, the select statement here uses the Left Join and WHERE clause to identify records that are in Table1 but not in Table2.
0
 
LVL 1

Expert Comment

by:Declan_Basile
ID: 38728044
Don't know how familiar you are with SQL.  If you aren't (or if you prefer) then you can create a new query graphically in design view and let Access create the SQL statement for you, essentially getting what fyed wrote as the result ...
   Create a new query, add both tables, draw lines between Table1.SSN and Table2.SSN, and between Table1.ConsultDate and Table2.Consultdate, Double Click each line and specify "Include all records from Table1" (the lines change to have an arrow on the Table2 side), drop Table2.SSN down to the grid (by dragging or double clicking it) and specify "Is Null" for the criteria.  Change the query type to "Append" and specify all the fields you want to append.
0
 

Author Closing Comment

by:shieldsco
ID: 38728046
Thanks fyed -- glad you understood
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38728056
You're welcome.  Glad to help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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