B
bhammerstrom.work
OK, I'm in over my head and need some more help.
The setup: The database has Places (addresses) where there are many
Inspections. The Inspections are at one Place and one InspectorDate.
Inspections have many Observations. One Observation can have either
one Issue filled-in (Observed Defective), or left Null (Not Observed).
Now the catch: One Place can have many InspectionTypes, and One Issue
can have many Inspection Types. The tblInspectionTypes is between them
separated by two junction tables, IssueDetails and PlaceDetails.
That's it.
What the report needs to do is group by Issue, then show all the
Observations where the PlaceInspType matches the IssueInspType,
grouped by GroupObservation. This will group a list of Defective
Observations followed by a list of Places also inspected by that
Issue's InspectionType, but where that Issue was not observed. Still
with me?
I created this query, below, that finally does all this, but I can't
get the subgroup to work in the report. Anyway, the idea is that I
want the report to group first by Issue, then by GroupObservation, and
give me a count of Places observed defective for each issue, along
with a count of Places also observed but that Issue was not observed.
SELECT qryObsWhereIssueInspMatchesPlaceInsp.ObservationID,
IIf(IsNull([ObservationID]),"Not Observed","Observed Defective") AS
GroupObservation, qryIssueInspMatchesPlaceInsp.Issue,
qryIssueInspMatchesPlaceInsp.Address
FROM qryIssueInspMatchesPlaceInsp LEFT JOIN
qryObsWhereIssueInspMatchesPlaceInsp ON (qryIssueInspMatchesPlaceInsp.
[tblIssueDet-Issue_ID] =
qryObsWhereIssueInspMatchesPlaceInsp.Issue_ID) AND
(qryIssueInspMatchesPlaceInsp.[tblPlacesDetail-Place_ID] =
qryObsWhereIssueInspMatchesPlaceInsp.PlaceID)
GROUP BY qryObsWhereIssueInspMatchesPlaceInsp.ObservationID,
qryIssueInspMatchesPlaceInsp.Issue,
qryIssueInspMatchesPlaceInsp.Address;
Can I do this with nested Groups? or do I need to do it with a
subreport?
Ideas?
-Brad
The setup: The database has Places (addresses) where there are many
Inspections. The Inspections are at one Place and one InspectorDate.
Inspections have many Observations. One Observation can have either
one Issue filled-in (Observed Defective), or left Null (Not Observed).
Now the catch: One Place can have many InspectionTypes, and One Issue
can have many Inspection Types. The tblInspectionTypes is between them
separated by two junction tables, IssueDetails and PlaceDetails.
That's it.
What the report needs to do is group by Issue, then show all the
Observations where the PlaceInspType matches the IssueInspType,
grouped by GroupObservation. This will group a list of Defective
Observations followed by a list of Places also inspected by that
Issue's InspectionType, but where that Issue was not observed. Still
with me?
I created this query, below, that finally does all this, but I can't
get the subgroup to work in the report. Anyway, the idea is that I
want the report to group first by Issue, then by GroupObservation, and
give me a count of Places observed defective for each issue, along
with a count of Places also observed but that Issue was not observed.
SELECT qryObsWhereIssueInspMatchesPlaceInsp.ObservationID,
IIf(IsNull([ObservationID]),"Not Observed","Observed Defective") AS
GroupObservation, qryIssueInspMatchesPlaceInsp.Issue,
qryIssueInspMatchesPlaceInsp.Address
FROM qryIssueInspMatchesPlaceInsp LEFT JOIN
qryObsWhereIssueInspMatchesPlaceInsp ON (qryIssueInspMatchesPlaceInsp.
[tblIssueDet-Issue_ID] =
qryObsWhereIssueInspMatchesPlaceInsp.Issue_ID) AND
(qryIssueInspMatchesPlaceInsp.[tblPlacesDetail-Place_ID] =
qryObsWhereIssueInspMatchesPlaceInsp.PlaceID)
GROUP BY qryObsWhereIssueInspMatchesPlaceInsp.ObservationID,
qryIssueInspMatchesPlaceInsp.Issue,
qryIssueInspMatchesPlaceInsp.Address;
Can I do this with nested Groups? or do I need to do it with a
subreport?
Ideas?
-Brad