supress subreport header?

  • Thread starter Thread starter dkingston
  • Start date Start date
D

dkingston

i have a main report that contains 5 subreports.
1 of the subreports contains 6 sub-subreports.
if 1 of the simple subreports is blank access DOES NOT
print the report or group headers from the subreport in
the main report. this is good.
if all 6 sub-subreports in the other subreport are blank
access DOES print the report header from the subreport in
the main report. this is bad.
is there something i can do to stop access from printing
the unwanted heading?
many many thanks for your time.

please reply via post or to:
d k i n g s t o n (at) j a g l y n n (dot) c o m
 
d:

You'll have to test each of the six sub-sub report's .hasdata properties and
then if all are false, supress the printing of the main sub report using VBA
code.

So in the section of the report that contains the main sub report, you'd use
code like:

Dim bDeadRptCounter as Byte

If Me!YourSubReportName.Report!YourSubSubRpt1.Report.HasData=False Then _
bDeadRptCounter = bDeadRptCounter +1
If Me!YourSubReportName.Report!YourSubSubRpt2.Report.HasData=False Then _
bDeadRptCounter = bDeadRptCounter +1
etc.

If bDeadRptCounter = 6 Then
Me!YourSubReportName.Visible = False
Else
Me!YourSubReportName.Visible = True
End if

To make that work effectively if you don't want the main subreport simply
take up room on the page when its not visible, then set it to have a very
small size with its can grow property set to true so that it will grow when
the subs actually have data.

HTH
 
Back
Top