1 Query from 2 tables

  • Thread starter Thread starter betsy
  • Start date Start date
B

betsy

I have 2 tables that track similar data in each, ie name,
date of birth, due date, etc. 1 for parent, 1 for child.
They are joint by the ParentID.

I need a query that will look at both tables and return
records for which the due date field in either/both tables
matches data inputed on a form.

I can get it to do one or the other but not both, I think
because of the "inner join". I can't remove the
relationship because I need to be able to track the child
thru the parent and vice versa. And I don't want to have 2
separate queries. Any help is GREATLY appreciated!!

Betsy
 
It would help if you posted the SQL text of your query. If I understand what
you want, you should be able to use an or statement.

Assuming that there is always at least one record in the child table for each
record in the Parent table then your inner join should not be a problem.

Select Parents.*, Children.*
FROM Parents INNER JOIN Children
On Parents.ParentID = Children.ParentID
WHERE Parents.DueDate = FORMS!SomeForm!SomeDate
OR Children.DueDate = FORMS!SomeForm!SomeDate

If you are doing this in the query grid, then put the criteria on two Different
lines.
 
I need a query that will look at both tables and return
records for which the due date field in either/both tables
matches data inputed on a form.

Just create a query joining the two tables on ParentID. Put

=[Forms]![formname]![controlname]

on the Criteria line under both of the Due Date fields, on separate
lines in the query grid so it will match either one.
 
Back
Top