Unanswered: Applying filter to report and subreport
I have a filter being applied to a report to restrict by date and is being applied to my main report. I have a copy of this report acting as a subreport, with all detail Visible=No and doing counts on this same data. However, when I attempt to pass the filter string to the subreport, I get errors.
This is my filter-building code:
strFilter = "([Cases.Date_of_Death] " & strStartDate & " AND [Cases.Date_of_Death] " & strEndDate & ") OR ([Cases.Discharge_Date] " & strStartDate & " AND [Cases.Discharge_Date] " & strEndDate & ")"
This is the code passing the filter to the main report (which works):
Reports(strReport).Filter = strFilter
Reports(strReport).FilterOn = True
This is my faulty code that is attempting to pass the same filter string to the subreport:
Reports(strReport).sbrptProcCompDeath.Report!Filte r = strFilter
Reports(strReport).sbrptProcCompDeath.Report!Filte rOn = True