Combining queries

S

Stephanie

Hi. I have 2 queries that are nearly identical.
Contacts (MemberOption=1) certify with Animals using NatlCertResults.
Contact (MemberOption<>1) certify with Animals using RegREADResults.

I am trying to create a form (display not entry) that is based on 2 queries.
Then I'll have 2 subforms each based on one of the queries. This will give
me Animal info on the main form, then one subform using NatlCertResults and
one subform using RegREADResults. I thought I could just use OR statements,
something along the lines of:
(Animals.AnimalsID)=[natlcertresults].[animalsid] OR
(Animals.AnimalsID)=[RegREADtresults].[animalsid]

Instead, I ended up with "grayed-out" query. I'll post the 2 queries in the
hopes that the discussion group could suggest how to combine them. Thanks
for your help!
(Note Individuals in the parent form, where the subform and its subform
reside).

qryNatlCertResults
SELECT Animals.AnimalsID, Contacts.ContactID, NatlCertResults.NatlCertDate
FROM (AnimalType RIGHT JOIN Animals ON AnimalType.AnimalTypeID =
Animals.AnimalTypeID) INNER JOIN (Contacts INNER JOIN NatlCertResults ON
Contacts.ContactID = NatlCertResults.ContactID) ON Animals.AnimalsID =
NatlCertResults.AnimalsID
WHERE (((Animals.AnimalsID)=[natlcertresults].[animalsid]) AND
((Contacts.ContactID)=[natlcertresults].[contactid] And
(Contacts.ContactID)=[forms]![individuals]![contactid]));

qryRegREADResults.
SELECT Animals.AnimalsID, Contacts.ContactID, RegREADResults.RegREADDate
FROM Contacts INNER JOIN (AnimalType RIGHT JOIN (Animals INNER JOIN
RegREADResults ON Animals.AnimalsID = RegREADResults.AnimalsID) ON
AnimalType.AnimalTypeID = Animals.AnimalTypeID) ON Contacts.ContactID =
RegREADResults.ContactID
WHERE (((Animals.AnimalsID)=[RegREADresults].[animalsid]) AND
((Contacts.ContactID)=[RegREADresults].[contactid] And
(Contacts.ContactID)=[forms]![individuals]![contactid]));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Count 8
Summing a sum 16
Update query 3
selecting union query results 7
Yes/No or None 12
2 similar tables, 1 query (?) 4
help 2
Form input 4

Top