format-retreat sequence

  • Thread starter Thread starter Jack Peacock
  • Start date Start date
J

Jack Peacock

I have some reports with complex totaling calculations which are performed
in the format event for group footers. I have created corresponding group
footer retreat event procedures to back out the totalling if the format
event is triggered more than once.

However when I run the report I see the group footer format called twice
when it occurs at the end/top of a page (as expected) but the retreat event
routine is not called after either format event. I verified this by placing
breakpoints in the format and retreat routines at the beginning. I see two
format breakpoints, no retreat breakpoints. I verified the retreat
procedure shows in the footer properties.

The environment is Access XP SP2 running on Windows XP SP1. In reading the
Access help on reports it seems to imply a Retreat event exists solely to
handle multiple format events when the section has to be moved from the end
of a page to the top of the next page. Is there some reason it doesn't
appear to be working? I've searched Technet but didn't find anything on
retreat events. I see this behavior in several reports.
Jack Peacock
 
Jack said:
I have some reports with complex totaling calculations which are performed
in the format event for group footers. I have created corresponding group
footer retreat event procedures to back out the totalling if the format
event is triggered more than once.

However when I run the report I see the group footer format called twice
when it occurs at the end/top of a page (as expected) but the retreat event
routine is not called after either format event. I verified this by placing
breakpoints in the format and retreat routines at the beginning. I see two
format breakpoints, no retreat breakpoints. I verified the retreat
procedure shows in the footer properties.

The environment is Access XP SP2 running on Windows XP SP1. In reading the
Access help on reports it seems to imply a Retreat event exists solely to
handle multiple format events when the section has to be moved from the end
of a page to the top of the next page. Is there some reason it doesn't
appear to be working? I've searched Technet but didn't find anything on
retreat events. I see this behavior in several reports.

This is a bummer Jack. No matter what you do, there are
situations where record to record calculations done in code
in the Format or Print events will not be able to avoid the
problem you're having. Reports are just too complex to
process in a sequential manner, so all calculations have to
be done using only values in the current record without
using any static or global variables. You must find another
way.

Many time the aggregate functions can be made to accomplish
the goal, but sometimes you'll need to use a RunningSum text
box. An alternative that can be very useful on ocassion is
to perform at least part of the calculations in the report's
record source query.
 
Marshall Barton said:
This is a bummer Jack. No matter what you do, there are
situations where record to record calculations done in code
in the Format or Print events will not be able to avoid the
problem you're having. Reports are just too complex to
process in a sequential manner, so all calculations have to
be done using only values in the current record without
using any static or global variables. You must find another
way.
I understand there are alternatives, but the root question is about the
retreat event. Why isn't it called when the footer section was formatted
twice at the page break? What's the point of even having a retreat event if
it isn't called when a section is formatted more than once? Is this
something in Access that's broke and not going to be fixed?
Jack Peacock
 
Jack said:
I understand there are alternatives, but the root question is about the
retreat event. Why isn't it called when the footer section was formatted
twice at the page break? What's the point of even having a retreat event if
it isn't called when a section is formatted more than once? Is this
something in Access that's broke and not going to be fixed?

I don't know the Access developers' plan, either then nor
for the future. Personally, I think the Retreat event was a
half baked idea that must(?) work in some trivial case, but
not in any even slightly complex situations. I think I can
understand the issue what with entire multilevel groups
being retreated across because of some high level group's
KeepTogether or other combinations of the many features
available in reports.

Bottom line is that I (any many others) have tried to work
through these problems and have never come up with a
foolproof approach. That's why I say to abandon the code
and spend your time working out an alternative technique.
 
Back
Top