Preview a Report and move to last page

Print
Category: VBA VBA
Last Updated: 13 September 2020 13 September 2020

The only way I have been able to figure out how to preview a report and have it automatically go to the last page is to use Sendkeys.

 

Here is an example code that works in the On Click event of a Command Button used to open the report:

{codecitation class="engine parameters" width="" }

'* open a report in preview mode

     DoCmd.OpenReport "Your Report Name Here", acViewPreview


'* used the keyboard shortcut to move to the last page.

     SendKeys "{End}", True

'
      DoEvents

 

{/codecitation}

 

Note: The Sendkeys will not work if placed in an event on the report.