Greetings:
I have a union query to pull witnesses to an incident from three main tables for a report. Consumers, employees, and non-staff. Two of the tables are further linked to others. All queries work alone, and any two will form a union, but I get an error message saying the object could not be found when I try to run the union will all three.
I do not see anything wrong with the code. I am beginning to wonder if my installation of Access 2007 running on XP is corrupted.
Here is my Code:
SELECT NonStaffDetail.IncidentID, NonStaffDetail.ID, NonStaffDetail.Witness, NonStaffDetail.Phone, NonStaffDetail.CofirmOtherStatus, NonStaffDetail.FullName
FROM NonStaffDetail
WHERE (((NonStaffDetail.Witness)=-1))
UNION ALL
SELECT ConsumerDetail.IncidentNum, ConsumerDetail.ConsumerID, ConsumerDetail.Witness, Consumer.Phone, ConsumerDetail.ConfirmConsStatus, ([FirstName] & " " & [LastName]) AS Fullname
FROM Consumer RIGHT JOIN ConsumerDetail ON Consumer.[Client ID] = ConsumerDetail.ConsumerID
WHERE (((ConsumerDetail.Witness)=-1))
UNION ALL
SELECT EmployeeDetail.IncidentID, EmployeeDetail.EmployeeID, EmployeeDetail.Witness, MasterEmployeee.PhoneNum, EmployeeDetail.ConfirmEmpStautus, MasterEmployeee.EmployeeName
FROM MasterEmployeee RIGHT JOIN EmployeeDetail ON MasterEmployeee.EmployeeID = EmployeeDetail.EmployeeID
WHERE (((EmployeeDetail.Witness)=-1));
Even if I simplify this to just one field it behaves the same. What am I missing here?
I have a union query to pull witnesses to an incident from three main tables for a report. Consumers, employees, and non-staff. Two of the tables are further linked to others. All queries work alone, and any two will form a union, but I get an error message saying the object could not be found when I try to run the union will all three.
I do not see anything wrong with the code. I am beginning to wonder if my installation of Access 2007 running on XP is corrupted.
Here is my Code:
SELECT NonStaffDetail.IncidentID, NonStaffDetail.ID, NonStaffDetail.Witness, NonStaffDetail.Phone, NonStaffDetail.CofirmOtherStatus, NonStaffDetail.FullName
FROM NonStaffDetail
WHERE (((NonStaffDetail.Witness)=-1))
UNION ALL
SELECT ConsumerDetail.IncidentNum, ConsumerDetail.ConsumerID, ConsumerDetail.Witness, Consumer.Phone, ConsumerDetail.ConfirmConsStatus, ([FirstName] & " " & [LastName]) AS Fullname
FROM Consumer RIGHT JOIN ConsumerDetail ON Consumer.[Client ID] = ConsumerDetail.ConsumerID
WHERE (((ConsumerDetail.Witness)=-1))
UNION ALL
SELECT EmployeeDetail.IncidentID, EmployeeDetail.EmployeeID, EmployeeDetail.Witness, MasterEmployeee.PhoneNum, EmployeeDetail.ConfirmEmpStautus, MasterEmployeee.EmployeeName
FROM MasterEmployeee RIGHT JOIN EmployeeDetail ON MasterEmployeee.EmployeeID = EmployeeDetail.EmployeeID
WHERE (((EmployeeDetail.Witness)=-1));
Even if I simplify this to just one field it behaves the same. What am I missing here?