By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

Question about reports, subreports, and page breaks

P: n/a
Folks,

I have four subreports in a report in the detail section. I suppose I
could move them to the footer of the report. Anyway, if any of them
have data, I want the main report to force a page break. I am trying
to use the "hasdata" property for the subreports, but I am getting the
generic error indicating property not available for object.

How does one tell the main report (using VBA) not to throw in a page
break unless the subreport has data? There has to be an easy set of
code for this. Thanks.

David

Sep 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

David wrote:
Folks,

I have four subreports in a report in the detail section. I suppose I
could move them to the footer of the report. Anyway, if any of them
have data, I want the main report to force a page break. I am trying
to use the "hasdata" property for the subreports, but I am getting the
generic error indicating property not available for object.

How does one tell the main report (using VBA) not to throw in a page
break unless the subreport has data? There has to be an easy set of
code for this. Thanks.

David
Don't forget that you have to refer to the report property of the
subreport when determining whether or not the subreport has data, i.e.

MySubreport.Report.HasData

That being said, I am assuming you could put a page break control at
the end of your detail section and something like the following in the
detail_format event of your main report to force a page break if any of
the reports have data:

If MySub1.Report.HasData Or _
MySub2.Report.HasData Or _
MySub3.Report.HasData Or _
MySub4.Report.HasData Then
PageBreak.Visible = True
Else
PageBreak.Visible = False
End If

Note that 'telling the main report NOT to throw in a page break' if the
subreports have no data is something different than telling the main
report to throw in a page break if the subreports do have data and
would be a much more complicated affair if it could even be achieved at
all.

HTH,
Bruce

Sep 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.