I have VB code that works to filter a main report running off a query. My primary goal is to do some counts on the main report and throw them into the report header, via a subreport. I've created a subreport running off the same query the main report is running off of, but only made the counts visible, and added them to the main report. Now I just need correct code to pass the filter string to both the main report and subreport.
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!Filter = strFilter
Reports(strReport).sbrptProcCompDeath.Report!FilterOn = True
sbrptProcCompDeath is the name of the report AND the name of the control. strReport is being chosen by a radio button and stored.
Any help is appreciated
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!Filter = strFilter
Reports(strReport).sbrptProcCompDeath.Report!FilterOn = True
sbrptProcCompDeath is the name of the report AND the name of the control. strReport is being chosen by a radio button and stored.
Any help is appreciated