Code Examples

Zoom Print Preview

acCmdFitToWindow, acCmdZoom10, acCmdZoom25, acCmdZoom50, acCmdZoom75, acCmdZoom100, acCmdZoom150, acCmdZoom200, acCmdZoom500, acCmdZoom1000

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
   ' DoCmd.RunCommand acCmdZoom500
   ' DoCmd.RunCommand acCmdZoom1000
End Sub

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

© 1998 - 2011 Terry Wickenden TKW Design Site developed maintained and hosted by TKW Design. This site is best viewed at 1024 x 768. Optimised for Firefox.