Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Report at Last Page 1

Status
Not open for further replies.

DavidOlly

Programmer
Sep 5, 2002
12
0
0
AU
How can I open a Report in Preview at the last page, please?
 
Never really tryed to do what you are doing, But would setting up the query that is housing the report in a descending order work for what you are doing??
 
Thanks for trying but no. This is a log and I need to keep page numbers sequential with latest date/time on the last page.
 
Create a control in the report and set its control source to:
=[Pages]

Then use the page event and SendKeys:

Private Sub Report_Page()
SendKeys "{F5}" & Str(Pages) & "{Enter}"
End Sub

Tried it with a 216 pages report and it worked fine...with one little bug: NumLock is deactivated...

[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
oooooops...This is not a one-time event, so let's check if it has already been triggered:

Private Sub Report_Page()
Static CommandSent As Boolean
If CommandSent Then Exit Sub
SendKeys "{F5}" & Str(Pages) & "{Enter}"
CommandSent = True
End Sub

Just in case you want to go to a previous page...

[smile]
[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Thanks Daniel - Just what I needed; it works a treat!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top