469,927 Members | 1,394 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Question about reports, subreports, and page breaks

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
1 3361

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.

Similar topics

5 posts views Thread by Prakash Wadhwani | last post: by
3 posts views Thread by Brad | last post: by
3 posts views Thread by Matt | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.