semi-complex - cancel report w/ several subreports

R

rgrantz

Just so everyone knows, I DO try to figure this stuff out for an hour or two
before posting...

My goal is to cancel the report when there is no data in the recordsource of
the main report. However, the On No Data cancel action for this main report
gives me the 2455 error ("you entered an expression that has an invalid
referenceto the property form/report"), because in the report's Detail
secton, I have code that makes several subreports INvisible if there is no
data in THEM (I'm doing the whole "if the subreport has no data, make it
invisible and show textboxes that show "0" thing). See, a lot of the time,
one, two, or all 3 of the 3 different subreports may have no data, in which
case I make one, two, or all 3 invisible and show textboxes that say "0"
instead. So the Main report still needs to run, and any (or 2, or all 3) of
the subreports may have no data, and so are invisible.

HOWEVER, when the recordsource for the MAIN report has no data, I want to
cancel the opening of the WHOLE report (with my normal msgbox that says "No
Data in that Date Range," of course). But since I have code in the On
Format event of the detail section that refers to each subreport (if [this
subreport has no data] then [this subreport].visible = false and [textbot
that shows 0].visible = true), I get a 2455 error when cancelling the main
report.

I can't cancel the MAIN report if the subreport(s) have no data, but I do
want to cancel the whole shebang if the Main report has no data. How can I
do this?

Thanks for any help, it is appreciated.
 
Top