T
Tina Hudson
Good day!
I'm trying to figure out how to set up a query. Here's the scoop:
I have 3 tables (tblPersonChild, tblPersonChild_Factors, and
tblPersonChild_Findings).
The first table contains [Person_ID] and demographic info I want to include
on a report. No duplicate children in this table.
The other 2 tables each contain: [ID], [Person_ID], [Factor] for
tblPersonChild_Factors; and [FInding_ID],[Person_ID],[Finding] for
tblPersonChild_Findings
There can be more than one factor and more than one finding for each child,
so duplicate children in this field.
The relationship is a 1 to many from tblPersonChild to the other 2 tables.
I have created a form that is a report menu with a list box for factors and
a list box for findings. The user can select however many factors and/or
findings they want to show on the report, and then the user clicks a cmd
button to open the report. The report shows the factors and findings
selected, and aggregated data for the basic demographic information,such as
age, race, gender, for the children who had the selected factors and/or
findings. It is okay that there is a duplicated count of the children.
However, I can't seem to figure out the query to do this. I've tried
including the 3 tables in a select query, but the relationship part is
messing things up (I think) because when I chose the join for All records
from the tblPersonChild table to the tblPersonChild_Factors table, I can't
chose the same join for the Findings table.
The query will run, but if there are more factors than findings, then the
finding is repeated. For example, if a child has 2 factors, and 1 findings,
this is the result:
ID Factor Finding
301 Substance Abuse Improper Discipline
301 Parental Skills Improper Discipline
I tried a Union query, but I would like to be able to differentiate between
a "factor" and a "finding".
Any suggestions and/or recommendations?
I'm trying to figure out how to set up a query. Here's the scoop:
I have 3 tables (tblPersonChild, tblPersonChild_Factors, and
tblPersonChild_Findings).
The first table contains [Person_ID] and demographic info I want to include
on a report. No duplicate children in this table.
The other 2 tables each contain: [ID], [Person_ID], [Factor] for
tblPersonChild_Factors; and [FInding_ID],[Person_ID],[Finding] for
tblPersonChild_Findings
There can be more than one factor and more than one finding for each child,
so duplicate children in this field.
The relationship is a 1 to many from tblPersonChild to the other 2 tables.
I have created a form that is a report menu with a list box for factors and
a list box for findings. The user can select however many factors and/or
findings they want to show on the report, and then the user clicks a cmd
button to open the report. The report shows the factors and findings
selected, and aggregated data for the basic demographic information,such as
age, race, gender, for the children who had the selected factors and/or
findings. It is okay that there is a duplicated count of the children.
However, I can't seem to figure out the query to do this. I've tried
including the 3 tables in a select query, but the relationship part is
messing things up (I think) because when I chose the join for All records
from the tblPersonChild table to the tblPersonChild_Factors table, I can't
chose the same join for the Findings table.
The query will run, but if there are more factors than findings, then the
finding is repeated. For example, if a child has 2 factors, and 1 findings,
this is the result:
ID Factor Finding
301 Substance Abuse Improper Discipline
301 Parental Skills Improper Discipline
I tried a Union query, but I would like to be able to differentiate between
a "factor" and a "finding".
Any suggestions and/or recommendations?