View Full Version : Close Report When SubReport Has No Data


AlanW
02-05-2002, 05:26 PM
I have a main report that has a subReport. The main Report has no recordsource. (The subReport does) How can I close the whole Report if the SubReport has no data.
Any assistance appreciated

Rich
02-05-2002, 11:20 PM
Can't you use the NoData event?

AlanW
02-06-2002, 01:23 AM
Hi Rich
If you use the NoData event in the subReport,(cancel=-1)that will not close the main Report. I tried adding:-

DoCmd.Close acReport,"MainReportName",,

to the NoData event of the subReport but that doesn't work.
Any ideas?
Thanks

[This message has been edited by AlanW (edited 02-06-2002).]

Rich
02-06-2002, 02:46 AM
Use the HasData method in the NoData event of the main report, haven't tried it but it should work.