I've built a task list that allows all tasks to be assigned and then tracks completion.
main table looks like this:
tblDiscrepancy
- DiscrepancyID
- DiscrepancyDescription
- DiscrepancyCorrectiveAction
- DiscrepancyAssignedTo
- DiscrepancyCompleteDate
- DiscrepancyVerifiedBy
Both DiscrepancyAssingedTo and DiscrepancyVerifiedBy source tblAuditStaff for a list of names.
tblAuditStaff
- AuditStaffID (PK AutoNumber)
- AuditStaffName
I am constructing a report that will list out all of the open tasks and who they belong to and who has verified them. Currently the report displays only the AuditStaffID field since that is the field that ends up being stored in the main table for "Assigned to" and "verified by" values.
How can I change my query to also include the names from tblAuditStaff and get them to diferentiate between the two fields "DiscrepancyVerifiedBy" and "DiscrepancyAssignedTo"?
Thanks
Code as it is now:
main table looks like this:
tblDiscrepancy
- DiscrepancyID
- DiscrepancyDescription
- DiscrepancyCorrectiveAction
- DiscrepancyAssignedTo
- DiscrepancyCompleteDate
- DiscrepancyVerifiedBy
Both DiscrepancyAssingedTo and DiscrepancyVerifiedBy source tblAuditStaff for a list of names.
tblAuditStaff
- AuditStaffID (PK AutoNumber)
- AuditStaffName
I am constructing a report that will list out all of the open tasks and who they belong to and who has verified them. Currently the report displays only the AuditStaffID field since that is the field that ends up being stored in the main table for "Assigned to" and "verified by" values.
How can I change my query to also include the names from tblAuditStaff and get them to diferentiate between the two fields "DiscrepancyVerifiedBy" and "DiscrepancyAssignedTo"?
Thanks
Code as it is now:
Code:
SELECT tblDiscrepancy.DiscrepancyAssignedTo, tblArea.AreaDesc, tblDiscrepancy.DiscrepancyDesc, tblDiscrepancy.DiscrepancyCorrectiveAction, tblDiscrepancy.DiscrepancyEstimatedCompDate, tblDiscrepancy.DiscrepancyActualCompDate, tblDiscrepancy.DiscrepancyVerifiedBy, tblDiscrepancy.DiscrepancyVerifiedDate, tblDiscrepancy.DiscrepancyRootCause, tblDiscrepancy.DiscrepancyOngoing, tblDiscrepancy.DiscrepancyNonGMP, tblDiscrepancy.DiscrepancyCompleted, tblDiscrepancy.DiscrepancyDuplicate
FROM (tblArea RIGHT JOIN tblObservedHeader ON tblArea.AreaID = tblObservedHeader.ObservedArea) RIGHT JOIN (tblAuditStaff RIGHT JOIN tblDiscrepancy ON (tblAuditStaff.AuditStaffID = tblDiscrepancy.DiscrepancyVerifiedBy) AND (tblAuditStaff.AuditStaffID = tblDiscrepancy.DiscrepancyAssignedTo)) ON tblObservedHeader.ObservedID = tblDiscrepancy.DiscrepancyTest
WHERE (((tblDiscrepancy.DiscrepancyEstimatedCompDate) Is Null) AND ((tblDiscrepancy.DiscrepancyOngoing)=False) AND ((tblDiscrepancy.DiscrepancyNonGMP)=False) AND ((tblDiscrepancy.DiscrepancyCompleted)=False) AND ((tblDiscrepancy.DiscrepancyDuplicate)=False)) OR (((tblDiscrepancy.DiscrepancyActualCompDate) Is Null) AND ((tblDiscrepancy.DiscrepancyOngoing)=False) AND ((tblDiscrepancy.DiscrepancyNonGMP)=False) AND ((tblDiscrepancy.DiscrepancyCompleted)=False) AND ((tblDiscrepancy.DiscrepancyDuplicate)=False)) OR (((tblDiscrepancy.DiscrepancyVerifiedBy) Is Null) AND ((tblDiscrepancy.DiscrepancyOngoing)=False) AND ((tblDiscrepancy.DiscrepancyNonGMP)=False) AND ((tblDiscrepancy.DiscrepancyCompleted)=False) AND ((tblDiscrepancy.DiscrepancyDuplicate)=False)) OR (((tblDiscrepancy.DiscrepancyVerifiedDate) Is Null) AND ((tblDiscrepancy.DiscrepancyOngoing)=False) AND ((tblDiscrepancy.DiscrepancyNonGMP)=False) AND ((tblDiscrepancy.DiscrepancyCompleted)=False) AND ((tblDiscrepancy.DiscrepancyDuplicate)=False))
ORDER BY tblDiscrepancy.DiscrepancyAssignedTo, tblArea.AreaDesc;