Me.Page is wrong

speakers_86

Registered User.
Local time
Yesterday, 21:41
Joined
May 17, 2007
Messages
1,919
In a report, how can I reliably get the page number I am currently looking at? If I am looking at a three page report and scroll to page three, then back to any other page, Me.page returns 3. Basically, it is correct until the end user gets to the end and then backs up.
 
This even happens when using screen.activereport. This is frustrating. I can see the proper page number on the screen, but I don't see a way to get it in vba. The code below works until you get to the end of the report and start to back track.

Code:
Public Sub a()
On Error GoTo err
    Dim ctl
    For Each ctl In Screen.ActiveReport.Controls
        Debug.Print ctl.Name
        Debug.Print ctl.Value
    Next
    Exit Sub
err:
    Debug.Print "error"
    Resume Next
End Sub
 
Wouldn't page number be dependant on the printing process? Landscape, portrait?
 
sounds odd, doesn't it.

You can put a footer of something like

"page " & [page] & " of " & [pages]

and it manages this correctly. I never use code to interact with a report, so I am not sure why [page] would not return the current page number.
 
me.page returns the page of the last formatted page, not the page currently on the screen. I don't think I can get the page number of whats on the screen accurately.
 

Users who are viewing this thread

Back
Top Bottom