Hello, I have a union query that is grabbing last name(from the employee table) and also grabbing card number and expiry date(from cardholder table) It seems to work, but only when I have one UNION ALL. Anymore and I get this error "The Microsoft Office Access database engine could not find object ". Make sure the object exist and that you spell its name and path name correctly"
code:
So it works fine, when I'm only selecting the top two or bottom two(two is the limit), or if I don't use the inner join(but i need to so I know the employee name) So i don't believe anything is spelled incorrectly
code:
Code:
SELECT tblEmployees.[LastName], tblEmployeeHolder.[ESSO#] as [Card Number], tblEmployeeHolder.ESSOExpiry as Expiry, "ESSO" as CardType
FROM tblEmployeeHolder
INNER JOIN tblEmployees ON
tblEmployeeHolder.hldName = tblEmployees.ID
WHERE [ESSO#] is not NULL
UNION ALL
SELECT tblEmployees.[LastName], [Sunoco#], SunocoExpiry, "Sunoco" as CardType
FROM tblEmployeeHolder
INNER JOIN tblEmployees ON
tblEmployeeHolder.hldName = tblEmployees.ID
WHERE [Sunoco#] is not NULL
UNION ALL
SELECT tblEmployees.[LastName], [Staples#], StaplesExpiry, "Staples" as CardType
FROM tblEmployeeHolder
INNER JOIN tblEmployees ON
tblEmployeeHolder.hldName = tblEmployees.ID
WHERE [Staples#] is NOT NULL
Last edited: