ViewChange Event

Microsoft Access Visual Basic

Private Sub Form_ViewChange(ByVal Reason As Long)

Reason    The PivotViewReasonEnum constant that indicates how the view was changed. Reason always returns –1 for PivotChart Views.

Example

The following example demonstrates the syntax for a subroutine that traps the ViewChange event. For this example to work, a reference must be set to the Microsoft Office Web Components 10.0 type library.

Private Sub Form_ViewChange(ByVal Reason As Long)
    If Reason = OWC.plViewReasonShowDetails Then
        MsgBox "You've opted to show details."
    End If
End Sub