<si************@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Do you know where in access i need to trap for the OpenReport action
canceled?
If the button is named cmdReport, then the coding for the OnClick event
would be something like:
Private Sub cmdReport_Click()
On Error GoTo Err_Handler
DoCmd.OpenReport "MyReport", acViewPreview
Exit_Handler:
Exit Sub
Err_Handler:
Select Case Err.Number
Case 2501
' The report has been cancelled due to no data
' The report's coding shows the message,
' so no need for another one here.
Case Else
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
End Select
Resume Exit_Handler
End Sub
' Assuming that the NoData code for the report is as before:
' Private Sub Report_NoData(Cancel As Integer)
' MsgBox "No matching records"
' Cancel = True
' End Sub