By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

Page event "skips" Detail formatting

P: n/a
Hi there,
I'm encountering an inexplicable problem with page formatting in
reports. Here's the easiest way to explain it:

The Detail section of my report contains two elements:
[unbound text box]
[DatabaseField]

And let's say I have the following VB code for the Detail_Format
event:
Me![unbound text box] = Me![unbound text box] + 1

The output of the report looks like this:

1
data item one
2
data item two
3
data item three
4
data item four

and so on...

This works fine unless a page break is encountered, in which case the
result actually looks like this:

1
data item one
2
data item two
3
data item three
---------Access inserts page break here--------
5
data item four

Apparently, Access "skips" a Detail_Format event. I've tried to trace
this and it appears that Access issues two Detail_Format events every
time it issues one Report_Page event, but somehow suppresses or
ignores the results from the first format event.

Has anyone else encountered this, and do you have any suggestions for
dealing with it?

Many thanks in advance for your wisdom,
-Eddy Bee

P.S. By the way, if I use Running Sum in the above example, it does
work correctly with page breaks. Unfortunately, the above example is
merely a simplified explanation of the problem - the actual formatting
requirements for my code are considerably more involved.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
When Access gets to the bottom of the page, it runs the Format event of the
detail section, discovers the page is not big enough, retreats, prints the
page, and runs the Format event *again* on the next page. The Retreat event
is probably your friend in this scenario. You may also need to check the
FormatCount argument.

However, the process you describe is not reliable enough to use. For
example, if you preview a report and jump to page 5 (or print only page 4),
the events may not run for the pages that were not previewed/printed. As a
result, we have found it unsafe to rely on event calculations that span
pages.

The running sum calculations are always reliable. Alternatively, perform the
calculation in the report's RecordSource (SQL expression) or in VBA. If the
code involves opening recordsets, the SQL solution (e.g. subquery) will be
more efficient.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Eddy Bee" <ed*****@yahoo.com> wrote in message
news:a5**************************@posting.google.c om...
Hi there,
I'm encountering an inexplicable problem with page formatting in
reports. Here's the easiest way to explain it:

The Detail section of my report contains two elements:
[unbound text box]
[DatabaseField]

And let's say I have the following VB code for the Detail_Format
event:
Me![unbound text box] = Me![unbound text box] + 1

The output of the report looks like this:

1
data item one
2
data item two
3
data item three
4
data item four

and so on...

This works fine unless a page break is encountered, in which case the
result actually looks like this:

1
data item one
2
data item two
3
data item three
---------Access inserts page break here--------
5
data item four

Apparently, Access "skips" a Detail_Format event. I've tried to trace
this and it appears that Access issues two Detail_Format events every
time it issues one Report_Page event, but somehow suppresses or
ignores the results from the first format event.

Has anyone else encountered this, and do you have any suggestions for
dealing with it?

Many thanks in advance for your wisdom,
-Eddy Bee

P.S. By the way, if I use Running Sum in the above example, it does
work correctly with page breaks. Unfortunately, the above example is
merely a simplified explanation of the problem - the actual formatting
requirements for my code are considerably more involved.

Nov 12 '05 #2

P: n/a
Thanks very much for the response, Allen.

What's strange is, my Retreat event procedures never seem to execute -
as if the events don't ever occur.

Thanks again,
-Eddy

"Allen Browne" <al*********@SeeSig.invalid> wrote in message news:<ND*******************@news-server.bigpond.net.au>...
When Access gets to the bottom of the page, it runs the Format event of the
detail section, discovers the page is not big enough, retreats, prints the
page, and runs the Format event *again* on the next page. The Retreat event
is probably your friend in this scenario. You may also need to check the
FormatCount argument.

However, the process you describe is not reliable enough to use. For
example, if you preview a report and jump to page 5 (or print only page 4),
the events may not run for the pages that were not previewed/printed. As a
result, we have found it unsafe to rely on event calculations that span
pages.

The running sum calculations are always reliable. Alternatively, perform the
calculation in the report's RecordSource (SQL expression) or in VBA. If the
code involves opening recordsets, the SQL solution (e.g. subquery) will be
more efficient.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.