Go to a report last page

  • Thread starter ielmrani via AccessMonster.com
  • Start date
I

ielmrani via AccessMonster.com

Hi,

I used the following code to make a report go to the last page when it opens:

Private Sub Report_Open(Cancel As Integer)
Dim I As Integer
DoCmd.OpenReport "rptEndOfDayReport", acViewPreview
I = Reports!rptEndOfDayReport.Pages
SendKeys "{F5}{Delete}"
SendKeys I & "{ENTER}"
End Sub

but I am getting this error message:

The page number you entered is invalid
for example, it may be a negative or invalid range, such as 6 to 3

Does anyone knows what's the problem and how to fix it?

Thanks in advance.

Ismail
 
F

fredg

Hi,

I used the following code to make a report go to the last page when it opens:

Private Sub Report_Open(Cancel As Integer)
Dim I As Integer
DoCmd.OpenReport "rptEndOfDayReport", acViewPreview
I = Reports!rptEndOfDayReport.Pages
SendKeys "{F5}{Delete}"
SendKeys I & "{ENTER}"
End Sub

but I am getting this error message:

The page number you entered is invalid
for example, it may be a negative or invalid range, such as 6 to 3

Does anyone knows what's the problem and how to fix it?

Thanks in advance.

Ismail

How about:

DoCmd.OpenReport "rptEndOfDayReport", acViewPreview
DoCmd.RunCommand acCmdFitToWindow
SendKeys "{END}"
 

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