Zoom Print Preview

This example opens a report called "CounterInformation" in print preview, maximizes the preview window and then zooms to fit the page to the window. Remove the remarked out lines for zooming to other views. To use the code, create a button on the form and paste the code into the On Click procedure.

'***************** Code Start *******************
'This code was originally written by Terry Wickenden.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.

Private Sub cmdPreview_Click()
   DoCmd.OpenReport "CounterInformation", acViewPreview
   DoCmd.Maximize
   DoCmd.RunCommand acCmdFitToWindow
'The number at the end represents the % zoom
   ' DoCmd.RunCommand acCmdZoom10
   ' DoCmd.RunCommand acCmdZoom25
   ' DoCmd.RunCommand acCmdZoom50
   ' DoCmd.RunCommand acCmdZoom75
   ' DoCmd.RunCommand acCmdZoom100
   ' DoCmd.RunCommand acCmdZoom150
   ' DoCmd.RunCommand acCmdZoom200
End Sub

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

Return to Example List