Report Page Event

C

Christos

This is my first post so I would like to start by saying that this is a great
site and it's amazing how helpfull, and knowledgeable, the contributors are.

My question relates to the page event and property. It seems that when a
report is previewed the page event occurs only when paging forward. In fact,
I wasn't able to have any event triggered paging backwards through the report
pages. Is this right, or am I doing something wrong?

The page property also updates only on forward paging. So when I try the
code given in Access help under 'Page Property' (see below), I get the right
caption only going forward. When I page backwards, the caption doesn't
update to the correct page number. The same happens if I use a timer event
on a form that displays the previewd report's page number in a text box.
When I page forward in the report preview, the form textbox shows the correct
page number, but when I page backwards the textbox doesn't update. It should,
according to Access help.

The following example is from Access help under 'Page Property' :

Example
The following example updates the report's caption to display the current
position in the report as the user pages back and forth in the report.

Private Sub Report_Page()
Me.Caption = "Now Viewing Page " & Me.Page & " Of " & Me.Pages & " Page(s)"
End Sub

Am I doing something wrong or is this a bug, or an incorrect example?
 
M

Marshall Barton

Christos said:
This is my first post so I would like to start by saying that this is a great
site and it's amazing how helpfull, and knowledgeable, the contributors are.

My question relates to the page event and property. It seems that when a
report is previewed the page event occurs only when paging forward. In fact,
I wasn't able to have any event triggered paging backwards through the report
pages. Is this right, or am I doing something wrong?

The page property also updates only on forward paging. So when I try the
code given in Access help under 'Page Property' (see below), I get the right
caption only going forward. When I page backwards, the caption doesn't
update to the correct page number. The same happens if I use a timer event
on a form that displays the previewd report's page number in a text box.
When I page forward in the report preview, the form textbox shows the correct
page number, but when I page backwards the textbox doesn't update. It should,
according to Access help.

The following example is from Access help under 'Page Property' :

Example
The following example updates the report's caption to display the current
position in the report as the user pages back and forth in the report.

Private Sub Report_Page()
Me.Caption = "Now Viewing Page " & Me.Page & " Of " & Me.Pages & " Page(s)"
End Sub

Am I doing something wrong or is this a bug, or an incorrect example?


IMO, it's a bad example. It could be done correctly and
more easily by using a text box expression.

Access is trying to improve performance by minimizing
processing and may do it differently in different versions.
When a report is printed, it is always done one page after
another so there's no problem there. OTOH, previewing can
do all kinds of jumping around and you can not predict the
order of any events.
 
C

Christos

Thanks for your prompt reply!
IMO, it's a bad example. It could be done correctly and
more easily by using a text box expression.

I found this example in Access Help and copy pasted it. Using a text box
gives the same results.
Access is trying to improve performance by minimizing
processing and may do it differently in different versions.
When a report is printed, it is always done one page after
another so there's no problem there. OTOH, previewing can
do all kinds of jumping around and you can not predict the
order of any events.

The funny thing is that I can't get ANY event to trigger going backwards in
report preview. Try it.

What I am trying to get out of this is someway to probe what page is being
viewed in Report Preview. The Page Property works if you page forward but
not backwards. It seems to me that once a Report Page has been rendered,
Access stops 'seeing it'.
 
M

Marshall Barton

Christos said:
Thanks for your prompt reply!


I found this example in Access Help and copy pasted it. Using a text box
gives the same results.


The funny thing is that I can't get ANY event to trigger going backwards in
report preview. Try it.

What I am trying to get out of this is someway to probe what page is being
viewed in Report Preview. The Page Property works if you page forward but
not backwards. It seems to me that once a Report Page has been rendered,
Access stops 'seeing it'.


I believe that once a page is rendered, Access tries to
"remember" it so it doesn't have to do all that work again
and again. IME, it's not all that great at remembering so
some little(?) things are not perfect. Short of some
elaborate API code, I don't think it's feasible to do what
you want.

Actually, I think the situation is far more complex than
what you are seeing. Have you tried jumping around in the
preview? E.g. by typing in the page box in the nav button
area, go to page 20 then back to 10, then 15 and 3 and see
what happens.
 
C

Christos via AccessMonster.com

Marshall said:
Actually, I think the situation is far more complex than
what you are seeing. Have you tried jumping around in the
preview? E.g. by typing in the page box in the nav button
area, go to page 20 then back to 10, then 15 and 3 and see
what happens.

Hi !

I tried it. If you type 10 and then 5 the preview and navigation bar text
box works normaly (as before). My text box also said 10 and then 5! I then
clicked the page back button and my text box gave the right page number : 4,
3, 2 but when I clicked once more to go to page 1, my text box kept
displaying 2.

I then paged forward. Preview and navigation bar text boxt worked fine (as
before) but my text box kept displaying 2, until i passed page 5 whereupon it
showed the correct number again: 6. I kept paging forward and my text box
displayed the correct page number up to 9. When I clicked to go to 10,
navigation bar showed 10 correctly (as before) but my text box kept showing 9.
I paged fore once again and both navigation and my text box showed correctly
11.

It seems that the page property can take each value only once. If you go to
page 10 say, then to 5 and then back to 10, then page property changes from
10 to 5 but doesn't change to back to 10.

That's why paging back to 1 from 2 didn't show in my text box: When the
report preview opened it opened to page 1. The page property had already had
value 1 !!

Would this be considered a bug, regarding what Access Help says about Page
Property:

"...The following example updates the report's caption to display the current
position in the report as the user pages back and forth in the report...."
 
M

Marshall Barton

Christos said:
I tried it. If you type 10 and then 5 the preview and navigation bar text
box works normaly (as before). My text box also said 10 and then 5! I then
clicked the page back button and my text box gave the right page number : 4,
3, 2 but when I clicked once more to go to page 1, my text box kept
displaying 2.

I then paged forward. Preview and navigation bar text boxt worked fine (as
before) but my text box kept displaying 2, until i passed page 5 whereupon it
showed the correct number again: 6. I kept paging forward and my text box
displayed the correct page number up to 9. When I clicked to go to 10,
navigation bar showed 10 correctly (as before) but my text box kept showing 9.
I paged fore once again and both navigation and my text box showed correctly
11.

It seems that the page property can take each value only once. If you go to
page 10 say, then to 5 and then back to 10, then page property changes from
10 to 5 but doesn't change to back to 10.

That's why paging back to 1 from 2 didn't show in my text box: When the
report preview opened it opened to page 1. The page property had already had
value 1 !!

Would this be considered a bug, regarding what Access Help says about Page
Property:

"...The following example updates the report's caption to display the current
position in the report as the user pages back and forth in the report...."


I agree that Help is flawed in more than a few places and,
IMO, your issue is one of the least annoying.

As I said before, it's the events that are not being
processed so your idea re keeping track of the viewed page
is doomed.

Maybe you should make the users specify the data they need
to see before openng the report instead of having them
navigate through all the data to see the page they want???
 
C

Christos via AccessMonster.com

Marshall said:
[quoted text clipped - 29 lines]
"...The following example updates the report's caption to display the current
position in the report as the user pages back and forth in the report...."

I agree that Help is flawed in more than a few places and,
IMO, your issue is one of the least annoying.

As I said before, it's the events that are not being
processed so your idea re keeping track of the viewed page
is doomed.

Maybe you should make the users specify the data they need
to see before openng the report instead of having them
navigate through all the data to see the page they want???


The report is Production Sheets for a bakery. Each page of the report has
three or four sections (depending on order size), each section with different
customer production details. When a customer calls and changes his order,
only one section of the page changes. It's preferable to print the whole
page and replace it in the Production Sheets than a page with just the
changed section.

I made a form that opens alongside the report preview, where the user can
enter the page number he read of the preview and print just that page.
Thankfully the page property works correctly if you use 'PrintOut, page'. I
just wanted to use a button that prints the currently viewed page instead of
having to enter the page number. The button I made works, as long as the
user pages only forward; then the page number returned to the button is
correct. I he/she pages back, the page number returned to the button is
wrong.
 
M

Marshall Barton

Christos said:
Marshall said:
Actually, I think the situation is far more complex than
what you are seeing. Have you tried jumping around in the
[quoted text clipped - 29 lines]
"...The following example updates the report's caption to display the current
position in the report as the user pages back and forth in the report...."

I agree that Help is flawed in more than a few places and,
IMO, your issue is one of the least annoying.

As I said before, it's the events that are not being
processed so your idea re keeping track of the viewed page
is doomed.

Maybe you should make the users specify the data they need
to see before openng the report instead of having them
navigate through all the data to see the page they want???


The report is Production Sheets for a bakery. Each page of the report has
three or four sections (depending on order size), each section with different
customer production details. When a customer calls and changes his order,
only one section of the page changes. It's preferable to print the whole
page and replace it in the Production Sheets than a page with just the
changed section.

I made a form that opens alongside the report preview, where the user can
enter the page number he read of the preview and print just that page.
Thankfully the page property works correctly if you use 'PrintOut, page'. I
just wanted to use a button that prints the currently viewed page instead of
having to enter the page number. The button I made works, as long as the
user pages only forward; then the page number returned to the button is
correct. I he/she pages back, the page number returned to the button is
wrong.


What do you do if the customer adds a bunch of new items to
the order? Seems like that could affect not only the one
page but all further pages.

Maybe you wouldn't be concerned with the page number issue
if you were not using a hybrid of a paper system and an
electronic system? I don't mean to sound flippant, but
trying to stimulate thoughts beyond the page number
question.
 
C

Christos via AccessMonster.com

Marshall said:
What do you do if the customer adds a bunch of new items to
the order? Seems like that could affect not only the one
page but all further pages.

Maybe you wouldn't be concerned with the page number issue
if you were not using a hybrid of a paper system and an
electronic system? I don't mean to sound flippant, but
trying to stimulate thoughts beyond the page number
question.
Hello Marshall

It's a weekly order. Usually the customers just change their quantities or
add one or two items, which ,unless it happens in a completely full report
page, poses no problem (the report is grouped to have complete sections in
each page. Chances are that there will be some space in each report page
rather than the sections being exactly the right size to fill the page
completely).

This system helps maintain the same number of pages and same layout. If they
add a lot of items, and spill to the next page, then indeed it's not so
elegant. A new page has to be added and the old entry has to be crossed out
in the existing sheet. It rarely happens however.

A hybrid paper electronic system is necessary. Paper is more robust and
easier to use in a bakery production floor.
 
M

Marshall Barton

Christos said:
It's a weekly order. Usually the customers just change their quantities or
add one or two items, which ,unless it happens in a completely full report
page, poses no problem (the report is grouped to have complete sections in
each page. Chances are that there will be some space in each report page
rather than the sections being exactly the right size to fill the page
completely).

This system helps maintain the same number of pages and same layout. If they
add a lot of items, and spill to the next page, then indeed it's not so
elegant. A new page has to be added and the old entry has to be crossed out
in the existing sheet. It rarely happens however.

A hybrid paper electronic system is necessary. Paper is more robust and
easier to use in a bakery production floor.


That all sounds reasonable. I just do not see a way to
reliably get the number of the currently viewed page. What
you are already doing may be a useful default, but
ultimately users will have to be reponsible for specifying
the page to print.
 
C

Christos via AccessMonster.com

Marshall said:
That all sounds reasonable. I just do not see a way to
reliably get the number of the currently viewed page. What
you are already doing may be a useful default, but
ultimately users will have to be reponsible for specifying
the page to print.

Yea, it works. Just wanted to improve it. You know how it is with these
things.

Thanks for your time and help!
 

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