Subreport needs same dynamic filter as main report

M

M Skabialka

I have a main report where it is opened using a filter which is created on a
form based on user selection of vehicles and repair items.
DoCmd.OpenReport stDocName, acViewPreview, , Me!strSQL
I have added a subreport to summarize the data in the main report:

If they chose Vehicle 1 and 2 , and want to know how many wheels, windows,
wipers and door were replaced (based on selections from multi-select list
boxes), the report and sub-report should show:

Vehicle 1 repairs
Wheels 2
Windows 1
Wipers 2
Vehicle 2 repairs
Wheels 4
Doors 1
Summary sub-report
Wheels 6
Windows 1
Wipers 2
Doors 1

The main report is filtering properly - the sub-report is counting all
vehciles and all repairs. If I link master or child with either vehicleID
or repairItem, it only summarizes the last vehicle.

How do I filter the subreport the same as the main report, ie, using
Me!strSQL, or link it somehow?
Mich
 
M

Marshall Barton

M said:
I have a main report where it is opened using a filter which is created on a
form based on user selection of vehicles and repair items.
DoCmd.OpenReport stDocName, acViewPreview, , Me!strSQL
I have added a subreport to summarize the data in the main report:

If they chose Vehicle 1 and 2 , and want to know how many wheels, windows,
wipers and door were replaced (based on selections from multi-select list
boxes), the report and sub-report should show:

Vehicle 1 repairs
Wheels 2
Windows 1
Wipers 2
Vehicle 2 repairs
Wheels 4
Doors 1
Summary sub-report
Wheels 6
Windows 1
Wipers 2
Doors 1

The main report is filtering properly - the sub-report is counting all
vehciles and all repairs. If I link master or child with either vehicleID
or repairItem, it only summarizes the last vehicle.

How do I filter the subreport the same as the main report, ie, using
Me!strSQL, or link it somehow?


I suggest that you change the subrepotr's record source
query to use the same criteria as the main report's query.

Trying to do that on the fly can get complicated.
 
M

M Skabialka

I am now deleting and recreating the entire control source query for the
sub-report each time the report is run, based on the user criteria. The
report uses the filter, the subreport uses a new query each time it runs.
Problem solved.
Mich
 

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

Top