Subreport Open Event - Modifying Report Filter
Posted on 2006-04-11
I have several reports that have a common query as their recordsource. On each report I filter the results programmatically using an expression similar to
Me.Filter = "[scheduledin] <= #" & dNextSunday & "#"
in the report's Open event.
These reports are ALSO subreports on an unbound parent report separated by page break controls for the purpose of printing all reports at once to the printer with stapling and hold punching.
My problem is that the parent report seems to be triggering the subreport open events. This causes an error because Me.Filter doesn't make sense to the parent since it's unbound.
How do I filter at runtime (because it's calculated based on the date) the subreports and have it also work when the subreport is being run alone?
Is there a way to know if it's running as a subreport that can be used in a conditional expression?