Me.Page Problem

G

Guest

I have a made a custom toolbar with a button that runs the following module

Function CurrentPage()

Dim intCurrentPageNo As Integer
Dim strMsg As String

intCurrentPageNo = Screen.ActiveReport.Page

strMsg = "You are on page " & intCurrentPageNo
MsgBox strMsg

End Function

It basically pops up a Message box that tells you which page of a report you
are on. The eventual purpose is to code in the printing of just the page
that you are viewing.

The code works fine when the report loads. On page 1 it says "You are on
Page 1", clicking the bottom navigation buttons to move forward and clicking
the button again yields "You are on Page 2".

However, clicking the "BACK" navigation button and returning to page 1
yields the following "You are on Page 2" Apparently the code is having
problems counting backwards. Tested on a 10 page report, if you navigate to
page ten and then back to page one pushing the buttons says "You are on Page
10".

Is there any workaround for this behaviour?


Thanks,

Jason
 
M

Marshall Barton

jsiburt said:
I have a made a custom toolbar with a button that runs the following module

Function CurrentPage()

Dim intCurrentPageNo As Integer
Dim strMsg As String

intCurrentPageNo = Screen.ActiveReport.Page

strMsg = "You are on page " & intCurrentPageNo
MsgBox strMsg

End Function

It basically pops up a Message box that tells you which page of a report you
are on. The eventual purpose is to code in the printing of just the page
that you are viewing.

The code works fine when the report loads. On page 1 it says "You are on
Page 1", clicking the bottom navigation buttons to move forward and clicking
the button again yields "You are on Page 2".

However, clicking the "BACK" navigation button and returning to page 1
yields the following "You are on Page 2" Apparently the code is having
problems counting backwards. Tested on a 10 page report, if you navigate to
page ten and then back to page one pushing the buttons says "You are on Page
10".

Is there any workaround for this behaviour?


You are going down a dead end road here. The Page property
has no relationship to the page that you are viewing. I am
personally unaware of a way to get the number of the page
displayed in the preview window, especially when considering
that the preview window can display 1, 2, 3, 4 or 6 pages.
 

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