Solved

Not IN

Posted on 2013-01-01
5
271 Views
Last Modified: 2013-01-01
Experts, I have the below APPEND query.  
I am trying to APPEND to tblConsortium where tblAgreements_thisPrj.AgtID is NOT IN tblConsortium.AgtID

There are records that should be APPENDED but when I run it there are 0 records to be APPENDED.  

What do you think is missing?
thanks.

INSERT INTO tblConsortium ( AgtID )
SELECT tblAgreements_thisPrj.AgtID
FROM tblAgreements_thisPrj
WHERE (((tblAgreements_thisPrj.AgtID) Not In (SELECT [tblConsortium].[AgtID] FROM [tblConsortium])));


APPEND_NOTIN
0
Comment
Question by:pdvsa
[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
5 Comments
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 38735214
I think this is what you are looking for:
INSERT INTO tblConsortium ( AgtID )
WHERE
(SELECT tblAgreements_thisPrj.AgtID
FROM tblAgreements_thisPrj
WHERE ((
(tblAgreements_thisPrj.AgtID)
 Not In (SELECT [tblConsortium].[AgtID] FROM [tblConsortium])
))
);

Open in new window


HTH,

Kent
0
 

Author Comment

by:pdvsa
ID: 38735223
Kent:  thanks for the response. I do get a syntax and it highlights the WHERE right below the INSERT.  what do you think now?
0
 
LVL 75
ID: 38735259
How are you executing this Append query? Have you turned off SetWarnings ? Because if so, it may be masking a error that is occurring.  Comment out any DoCmd.SetWarnings False and see if an error is occurring.

mx
0
 
LVL 26

Accepted Solution

by:
jerryb30 earned 500 total points
ID: 38735265
INSERT INTO tblConsortium ( agtID )
SELECT tblConsortium.agtID
FROM tblAgreements_thisPrj LEFT JOIN tblConsortium ON tblAgreements_thisPrj.agtID = tblConsortium.agtID
WHERE (((tblConsortium.agtID) Is Null));
0
 

Author Closing Comment

by:pdvsa
ID: 38735280
Jerry:  that was it.  I remember that Is Null trick now.  I guess that method is better than NOT IN.  I will write that down.  

thank you
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

615 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