VBA/Excel/Access/Word/Access/Report Event — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:46, 26 мая 2010
Содержание
- 1 Activate toolbar with DoCmd.ShowToolbar
- 2 Close form without saving
- 3 Deactivate toolbar DoCmd.ShowToolbar
- 4 Report Error Event
- 5 Report Open event
- 6 Sub Report_Close()
- 7 Sub Report_NoData(Cancel As Integer)
- 8 Sub Report_Open(Cancel As Integer)
- 9 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
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