Carte du site
 États (rapports)

 Termes d'usage

États: Zoom personnalisé dans les états

Radu Lascae

--Soumis par Radu Lascae---

Zoom personnalisé dans les états.

La méthode interne relative aux zooms dans le mode de prévisionnement (RunCommand  acCmdZoom*) ne permet pas de niveaux personnalisés.

Plutôt que d'utiliser DoCmd.RunCommand acCmdZoom150, ou une autre constante, vous pouvez utiliser la propriété ZoomControl de l'objet état, mais utiliser avec attention! Cette méthode  n'est pas documentée où que ce soit.

'*********** Code Start ************
Function PreviewAndZoomReport(ReportName As String, ZoomCoeff As Integer)
    'function written by Radu Lascae <>,
    'use it at will standard disclaimer applies
    '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.
    'I have found it in a code snippet from a VB5 book.
    'ZoomControl is a Variant that accepts virtually everything
    'that can be converted to a number, positive, negative, small or large.
    'The property behaves nicely if "normal" numbers are passed.
    'This function allows an integer from 0 = ZoomToFit to 2500(%).
    'If the value is out of range, the function uses ZoomToFit.
    'The highest readable zoom I could achieve is about 2900(%) (!!!), this
    'depends on the minimum scrollbar increment.
    'The property is available for any open report that has the focus,
    'irrespective if the toolbar is visible or not.
    On Error GoTo Error_Handler
    If Not (ZoomCoeff >= 0 And ZoomCoeff <= 2500) Then
        ZoomCoeff = 0
    End If
    With DoCmd
        .OpenReport ReportName, View:=acViewPreview
    End With
    Reports(ReportName).ZoomControl = ZoomCoeff
    Exit Function
    MsgBox Err.Description
    Resume Next
End Function
'*********** Code End ************

© 1998-2001, Dev Ashish, All rights reserved. Optimized for Microsoft Internet Explorer