Solved

Not IN

Posted on 2013-01-01
5
228 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
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now