The build in method for zooming a report in Preview mode (RunCommand
acCmdZoom*) does not allow for custom zoom levels.
Instead of using DoCmd.RunCommand acCmdZoom150, or another built-in
constant, you may use the ZoomControl property of the Report object. Use with care! The property is
not documented anywhere.
Function PreviewAndZoomReport(ReportName As String, ZoomCoeff As Integer)
On Error GoTo Error_Handler
If Not (ZoomCoeff >= 0 And ZoomCoeff <= 2500) Then
ZoomCoeff = 0
End If
With DoCmd
.OpenReport ReportName, View:=acViewPreview
.Maximize
End With
Reports(ReportName).ZoomControl = ZoomCoeff
Exit Function
Error_Handler:
MsgBox Err.Description
Resume Next
End Function
|