Insert page-break at run-time in a report?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

MS Access 2K, Windows XP
====================
Hi,

I have an unbound report with 3 sub-reports. I make the sub-reports visible
if there is data in them, and also, the sub-reports can grow and shrink.

I would like to format the report so that each sub-report starts on a new
page. To accomplish this, I've tried inserting a page break between the 2nd
and 3rd sub-reports. It's working fine except when the second sub-report has
no data, and in that case, there is a blank page in between the first and
second sub-report.

I've also tried inserting a page-break in the "report footer" of first and
second sub-reports, but that hasn't worked.

I was wondering if there is a workaround this issue, and will appreciate it
if someone can shed some light on it.

The ideal solution is to insert a page-break at run-time between the
sub-reports if the next sub-report is not empty. Or, any other solution that
will give the same result.

Thanks!

-Amit
 
Amit said:
MS Access 2K, Windows XP
====================
I have an unbound report with 3 sub-reports. I make the sub-reports visible
if there is data in them, and also, the sub-reports can grow and shrink.

I would like to format the report so that each sub-report starts on a new
page. To accomplish this, I've tried inserting a page break between the 2nd
and 3rd sub-reports. It's working fine except when the second sub-report has
no data, and in that case, there is a blank page in between the first and
second sub-report.

I've also tried inserting a page-break in the "report footer" of first and
second sub-reports, but that hasn't worked.

I was wondering if there is a workaround this issue, and will appreciate it
if someone can shed some light on it.

The ideal solution is to insert a page-break at run-time between the
sub-reports if the next sub-report is not empty. Or, any other solution that
will give the same result.


Use code in the main report's detail section's Format event:

Me.pgBreak1.Visible = Me.subreport1.Report.HasData
Me.pgBreak2.Visible = Me.subreport2.Report.HasData
 
Marshall Barton said:
Use code in the main report's detail section's Format event:

Me.pgBreak1.Visible = Me.subreport1.Report.HasData
Me.pgBreak2.Visible = Me.subreport2.Report.HasData

Hi Marshall,

Thanks. That worked.
Actually, I'd tried the same statement earlier, but when I added
"me.pagebreak.", it didn't give an option for "visible" (like it does for a
text control), so I thought that "visible" was not available for a Page Break
control.
It's working now.

Cheers,
-Amit
 
Back
Top