Find missing entries Query

Coleman984

Registered User.
Local time
Today, 00:12
Joined
Jul 28, 2011
Messages
89
I have found a few things on this on the internet but none of it makes sense to me. I need a query that will look for persons that are missing jobs. The setup is as follows:

tblEmployee contains the following fields:
pkEmployeeID as Autonumber
txtFName as text
txtLName as text
EmpIDNo as number
dteHire as date/time
fkDeptID as number
dteInactive as date/time

tblEmployeeJobDescriptions contains the following fields:
pkEmpJobDescID as Autonumber
fkEmployeeID as Number
fkJobDescID as Number

What I need to do is find when an employee that is found in tblEmployee but is either not found in tblEmployeeJobDescriptions or the field fkJobDescID is blank.
 
using a website I think I constructed the sql statement I will need to do the check to find missing entries. However now that I have this statement. I do not know how to apply it to a query. Using VBA how do I apply this to a query?

Also does the sql string look ok?

sqlString = "SELECT tblEmployee.pkEmployeeID, tblEmployee.txtFName,tblEmployee.txtLName FROM tblEmployee Left JOIN tblEmployeeJobDescriptions ON " & _
"tblEmployee.pkEmployeeID=tblEmployeeJobDescriptions.fkJobDescID WHERE tblEmployeeJobDescriptions.fkJobDescID is Null or """
 
Last edited:
figured it out, query sql view.

and this is the sql statement that worked for what I needed:


SELECT tblEmployee.pkEmployeeID, tblEmployee.txtFName, tblEmployee.txtLName
FROM tblEmployee LEFT JOIN tblEmployeeJobDescriptions ON tblEmployee.pkEmployeeID = tblEmployeeJobDescriptions.fkEmployeeID
WHERE (((tblEmployeeJobDescriptions.fkJobDescID) Is Null));
 

Users who are viewing this thread

Back
Top Bottom