Code Examples For RunCommand Constants

Preview A Number of Pages

acCmdPreviewOnePage, acCmdPreviewTwoPages, acCmdPreviewFourPages, acCmdPreviewEightPages, acCmdPreviewTwelvePages

This function is designed to be called from buttons behind a custom toolbar on a report. Set the On Action Property of the button to "=TBPreviewPage(X)" where X is 1, 2, 4, 8 or 12 and represents the number of pages to be previewed at once.

'***************** Code Start *******************
' Code by Terry Wickenden

Function TBPreviewPage(intNumb As Integer)
    Select Case intNumb
        Case 1
            DoCmd.RunCommand acCmdPreviewOnePage
        Case 2
            DoCmd.RunCommand acCmdPreviewTwoPages
        Case 4
            DoCmd.RunCommand acCmdPreviewFourPages
        Case 8
            DoCmd.RunCommand acCmdPreviewEightPages
        Case 12
            DoCmd.RunCommand acCmdPreviewTwelvePages
    End Select
End Function

'****************** Code End ********************