Hello,
I'm trying to use a union query as the row source for a combo box wherein the user can select data in a field from two tables but I'm running into problems and don't know if it lies in the query itself or my setup. The two tables involving the union query
are tblAthletes and tblContacts. I also have another table which is called tblRoster with primary key fields of AthleteID and EventID. The situation is that a roster can consist of people from tblContacts and/or people from tblAthletes.
The SQL for the form is:
SELECT tblRosters.AthleteID, tblRosters.EventID
FROM tblRosters;
The SQL for the combo box AthleteID is:
SELECT tblContacts.ContactID AS ID, [FirstName] & " " & [LastName] AS FullName, tblContacts.Active
FROM tblContacts
WHERE (((tblContacts.Active)=False))
UNION ALL SELECT tblAthletes.AthleteID AS ID, [FirstName] & " " & [LastName] AS [Full Name], tblAthletes.Active
FROM tblAthletes
WHERE (((tblAthletes.Active)=False))
ORDER BY FullName;
All the names from both tables appear in the combo box, but I'm only able to select names from the tblContacts. I get an error "You cannot add or change a record because a related record is required in table 'tblContacts'" if I try to select a name from
the tblAthletes.
First is what I'm trying to do possible, if so I'm hoping someone can help resolve my problem.
Thanks,
Mike