So you want to force a page break before the last detail section, if there
is not room to fit it and the group footer section on the page?
Use the Format property of the Detail section to examine the Top property of
the report. If there's not enough room left, turn on the Visible property of
a PageBreak control to force the section onto the next page.
The Top property is in twips, where 1440 twips = 1 inch.
Obstacles to overcome:
================
1. You only want to break on the last detail record for the group. That
means you need to use the Group Header to lookup the primary key value of
the last record in the section, and only apply the code in Detail_Format if
it is that record.
2. Knowing the last detail record for the section is more difficult if the
report is filtered. You can easily read the Filter property, but there is a
bug in Access where it does not maintain the FilterOn property of the report
reliably, so you cannot know if the filter is really applied or not. More
info:
Incorrect filtering of forms and reports
at:
http://members.iinet.net.au/~allenbrowne/bug-02.html
3. If the Detail or Group Footer sections CanGrow or CanShrink, you will not
know how much space is needed for them.