Keeping total in section footer with last detail?

  • Thread starter Thread starter Max Moor
  • Start date Start date
M

Max Moor

Hi All,
Is there a simple way to make the total for a section stay with the
last deatail? In other words, if the total for a section has to go on the
next page, I want the last detail to go there as well, so it isn't so
isolated.

- Max
 
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.
 
Allen said:
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.


You can determine the last detail by having a group header
text box with =Count(*) and a detail text box with
expression =1 and RunningSum set to Over Group.
 
Ouch... Okay, thanks Allen and Marsh. I do filter the recordset almost
all the time, and all my headers and footers can grow and shrink. Maybe
I'll wait and do this one down the road a piece.

Thanks again, Max
 
Marshall Barton said:
You can determine the last detail by having a group header
text box with =Count(*) and a detail text box with
expression =1 and RunningSum set to Over Group.


Thanks, Mash. Yes, that would work well.
 
Back
Top