VBA/Excel/Access/Word/Access/Report Event — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 16:33, 26 мая 2010

Activate toolbar with DoCmd.ShowToolbar

 
Private Sub Report_Activate()
         DoCmd.ShowToolbar "AllOrders", acToolbarYes
End Sub



Close form without saving

 
Private Sub Report_Close()
      DoCmd.Close acForm, "frmReportFilter", acSaveNo
End Sub



Deactivate toolbar DoCmd.ShowToolbar

 
Private Sub Report_Deactivate()
       DoCmd.ShowToolbar "AllOrders", acToolbarNo
End Sub



Report Error Event

 
Private Sub Report_Error(DataErr As Integer, Response As Integer)
    If DataErr = 2580 Then
        MsgBox "Record Source Not Available for this Report"
        Response = acDataErrContinue
    End If
End Sub



Report Open event

 
Private Sub Report_Open (Cancel As Integer)
        Dim blnResultintResult      As Integer
        Dim strWarning     As String
        strWarning = "This report may take some time." & _
             " Or press Cancel to abort the operation."
        intResult = MsgBox (strWarning, vbOKCancel, "Warning")
        If intResult = vbCancel Then
              Cancel = True
        End If
End Sub



Sub Report_Close()

 
    DoCmd.Close acForm, "frmReportDateRange"
End Sub



Sub Report_NoData(Cancel As Integer)

 
    MsgBox "There is no data for this report. Canceling report..."
    Cancel = True
End Sub



Sub Report_Open(Cancel As Integer)

 
    On Error Resume Next
    DoCmd.OpenForm "frmReportDateRange", _
        WindowMode:=acDialog, _
        OpenArgs:="rptProjectBillingsbyWorkCode"
    If Not IsLoaded("frmReportDateRange") Then
        MsgBox "Criteria Form Not Successfully Loaded, " & _
            "Canceling Report"
        Cancel = True
    End If
End Sub



The Page event gives you the opportunity to do something immediately before the formatted page is sent to the printer: place a border around a page

 
Sub Report_Page()
    Me.Line (0, 0)-(Me.ScaleWidth - 30, Me.ScaleHeight - 30), _
        RGB(255, 0, 0), B
End Sub