Hello:
I am trying to put together a list that is a combination of two queries however I am not sure how to go about it. All attempts to join them have been futile
My first query determines which departments have had an incident within the past two months.
Code:
SELECT EmpIncidents.incidentID, EmpIncidents.empID, EmpIncidents.incidentTypeID, EmpIncidents.incidentDt, Dept.dept, IIf([IncidentTypeID]=1,"No","Yes") AS Restricted, IIf([IncidentTypeID]=1,Null,DateAdd("m",2,[IncidentDt])) AS EndDt, EmpIncidents.deptID AS OLDdeptID
FROM EmpIncidents INNER JOIN Dept ON EmpIncidents.deptID = Dept.deptID
WHERE (((EmpIncidents.incidentTypeID) In (2,3)) AND ((([EmpIncidents].[incidentDt]) Between DateSerial(Year(Date()),Month(Date())-2,1) And Date())));
My second query is determines what department each employee is in currently
Code:
SELECT Employee.empID, DeptTrans.deptID AS CurrentDept, Employee.empName
FROM Employee, DeptTrans
WHERE (((Employee.empID)=[DeptTrans].[empID]) AND ((DeptTrans.transEndDT) Is Null));
I need to filter out employees who are in a department that has had an incident, regardless of whether they are the employee in that department who received the incident. I tried joining them on deptID, but that did not produce a correct list. I plan to use this list to update employee leave. Am I missing something??
Any assistance would be greatly appreciated.