Force page break when data exists for subreport

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

Is it possible to force a page break before a subreport -
but only if data exists in the subreport?

(The subreport is situated in the "report footer" section
of the report - and is to print as an addendum when
required. It uses the same page headings and footings as
it's parent.)


I've tried:

* setting property "force new page" = "before section" in
the properties for the Group Header of the sub report -
does not seem to pick this up when launched from the main
report.

* setting property "force new page" = "after section" on
the Details section - as expected this forces a new page
whether it is wanted or not.

* inserting a page break object from toolbox - and trying
to manipulate it's properties via VB - viz:

Reports![#MainReport].ParentPageBreak.Visible = False

- not successful - looking at the properties of the page
break "ParentPageBreak" - visible doesn't seem to be an
available attribute

* moving the page break "ParentPageBreak" into it's own
group footer - and manipulating the visibility of that
section of the report:

Reports![#MainReport].GroupFooter0.Visible = True

- this produces amazing results! It would appear that
Access no longer has any idea of how many records exist
per page in the "parent" report. Sometimes only one line
appears on a page. Report length (previously 3 pages)
suddenly launches to 17. As I navigate through the pages
even displayed "page 4 of 3".
 
Kim:

1.) You can't use page headings / footings in subs, only report headings /
footings and group headings and footers.

2.) To solve the other problem, add a page break control just before the sub
report in your main report., Then in the On Print section of the section
that contains the sub report, add code like this:

If Me!YourSubreportName.Report.HasData Then
Me!NameOfPageBreakControl.Visible = True
Else
Me!NameOfPageBreakControl.Visible = False
End if

You might also want to narrow the vertical size of the sub as shown on the
main report to almost nil, so that it doesn't occupy space when it has no
data, set the sub report's Can Grow property to yes.

That should do it....
 
Thanks Steve,

1. Worked that bit out - was only fiddling with group
headers/footers.

2. Thanks. That was what I was trying to do in my
Attempt Three. It seems it all hinges of choosing the
correct event in the correct part of the report.

Regards,

Kim.
-----Original Message-----
Kim:

1.) You can't use page headings / footings in subs, only report headings /
footings and group headings and footers.

2.) To solve the other problem, add a page break control just before the sub
report in your main report., Then in the On Print section of the section
that contains the sub report, add code like this:

If Me!YourSubreportName.Report.HasData Then
Me!NameOfPageBreakControl.Visible = True
Else
Me!NameOfPageBreakControl.Visible = False
End if

You might also want to narrow the vertical size of the sub as shown on the
main report to almost nil, so that it doesn't occupy space when it has no
data, set the sub report's Can Grow property to yes.

That should do it....
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

Is it possible to force a page break before a subreport -
but only if data exists in the subreport?

(The subreport is situated in the "report footer" section
of the report - and is to print as an addendum when
required. It uses the same page headings and footings as
it's parent.)


I've tried:

* setting property "force new page" = "before section" in
the properties for the Group Header of the sub report -
does not seem to pick this up when launched from the main
report.

* setting property "force new page" = "after section" on
the Details section - as expected this forces a new page
whether it is wanted or not.

* inserting a page break object from toolbox - and trying
to manipulate it's properties via VB - viz:

Reports![#MainReport].ParentPageBreak.Visible = False

- not successful - looking at the properties of the page
break "ParentPageBreak" - visible doesn't seem to be an
available attribute

* moving the page break "ParentPageBreak" into it's own
group footer - and manipulating the visibility of that
section of the report:

Reports![#MainReport].GroupFooter0.Visible = True

- this produces amazing results! It would appear that
Access no longer has any idea of how many records exist
per page in the "parent" report. Sometimes only one line
appears on a page. Report length (previously 3 pages)
suddenly launches to 17. As I navigate through the pages
even displayed "page 4 of 3".


.
 
Back
Top