Orphaned Report Footer

D

Darrell

I know how to avoid part of a detail record being orphaned from its
parent on the previous page. However... how does one keep the report
footer from being orphaned since it is not "part of" anything else?

Help!

Darrell
 
M

Marshall Barton

Darrell said:
I know how to avoid part of a detail record being orphaned from its
parent on the previous page. However... how does one keep the report
footer from being orphaned since it is not "part of" anything else?


If I understand yout meaning of "orphan" to be on a page by
itself, then you have to use code to make sure that the last
detail is not near the bottom of the page.

First you need a way to determine when you are processing
the last detail. Add a hidden text box (named
txtTotalDetails) to the report header section and set its
control source expression to =Count(*). Then add a
hidden(?) text box (named txtDetailCount) to the detail
section. Set its control source expression to =1 and its
RunningSum property to Over All. Now add a Page Preak
control (named pgEject) to the top of the detail section.

With that done, add a line of code to the detail section's
Format event procedure:

Me.pgEject.Visible = (txtTotalDetails = txtDetailCount) _
And (Me.Top > 10 * 1440 - Me.Section(2).Height _
- Me.Sectopn(0).Height)

Replace the 10 with your paper height (in inches) less the
top margin.

If your detail section or report footer has its CanGrow
property set to Yes, then it is not possible to do this
accurately.
 
D

Darrell

Marshall said:
If I understand yout meaning of "orphan" to be on a page by
itself, then you have to use code to make sure that the last
detail is not near the bottom of the page.

First you need a way to determine when you are processing
the last detail. Add a hidden text box (named
txtTotalDetails) to the report header section and set its
control source expression to =Count(*). Then add a
hidden(?) text box (named txtDetailCount) to the detail
section. Set its control source expression to =1 and its
RunningSum property to Over All. Now add a Page Preak
control (named pgEject) to the top of the detail section.

With that done, add a line of code to the detail section's
Format event procedure:

Me.pgEject.Visible = (txtTotalDetails = txtDetailCount) _
And (Me.Top > 10 * 1440 - Me.Section(2).Height _
- Me.Sectopn(0).Height)

Replace the 10 with your paper height (in inches) less the
top margin.

If your detail section or report footer has its CanGrow
property set to Yes, then it is not possible to do this
accurately.
Marsh,

Sorry for the delayed response. I got pulled into another project and
sort-of dropped this for a couple of days.

Thank you for the methodology. Since the detail section's CanGrow is
Yes, it probably won't work this time. But, I will definitely add this
to my tool pouch for future use.

Darrell
 
M

Marshall Barton

Darrell said:
Sorry for the delayed response. I got pulled into another project and
sort-of dropped this for a couple of days.

Thank you for the methodology. Since the detail section's CanGrow is
Yes, it probably won't work this time. But, I will definitely add this
to my tool pouch for future use.


The problem when CanGrow is Yes is that the Format event
does not "know" the final height of the section, making that
calculation inappropriate. (The final Height of the section
is available in the Print event, but that's too late to do
what's needed.)

If you really need to pursue this, you can use the
fTextWidthHeight function at www.lebans.com to try (very
accurate, except in some odd situations) to calculate the
final Height of the controls that can grow. You can then
determine the tallest control and from that, calculate the
section's final Height.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top