"NOT" criteria

L

Liz Hansen

Hello,

I need to compare two tables. When compared, if an employeeID is missing
from the tblDemographics, it should be added using an append query. I'm
obviously doing something wrong cause' right now it can't find the missing
records...

Tables:
Employee (main table with all records)
tblDemographics (may have missing records)

Field:
employeeid

This is the SQL statement so far:

SELECT employee.employeeid
FROM employee INNER JOIN tblDemographics ON employee.employeeid =
tblDemographics.EmployeeID
WHERE ((Not (tblDemographics.EmployeeID)=[tblDemographics]![EmployeeID]))
GROUP BY employee.employeeid;

Any help is very much appreciated.

Best,

Liz
 
J

JL

1) If you are doing a join, you have to do LEFT JOIN.
Go to design mode in the query. Right click on the
relationship in the table above and select "Join Property".
Click on include all record from teh Master (Employee)
and ....
2) Change you WHERE clause to tblDemographics.EmployeeID
is null (or = "").

I think that should work.

SELECT employee.employeeid
FROM employee LEFT JOIN tblDemographics ON
employee.employeeid = tblDemographics.EmployeeID
WHERE tblDemographics.EmployeeID is null;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top