Easy-Squeezy, Darrell. That is Err.Number 2501
Use an Error trap like this one:
Private Sub Command0_Click()
If gbolErrorTrapOff = False Then On Error GoTo err_PROC
'Code Goes Here
DoCmd.OpenReport "MyReport"
exit_PROC:
On Error Resume Next
Exit Sub
err_PROC:
Dim strErrMsg As String
Dim lngIcon As Long
Select Case Err.Number
Case 2501
'Open cancelled.
strErrMsg = "No information for selected filter."
lngIcon = vbOKOnly + vbInformation
Case Else
strErrMsg = "Error " & Err.Number & " (" & Err.Description & ") " _
& "occurred in procedure testMe of " _
& "VBA Document Form_Form1"
lngIcon = vbOKOnly + vbInformation
End Select
If strErrMsg <> "" Then MsgBox strErrMsg, lngIcon, _
GetSummaryInfo("Title")
Resume exit_PROC
End Sub
Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com
---In MS_Access_Professionals@yahoogroups.com, <DEmbrey@bcbsm.com> wrote:
Greetings All,
Is there a way to suppress the message "The OpenForm action was cancelled." after setting the Cancel argument for the Form Open event to true? I'm already supplying a message to the user that there is data to display.
Darrell
The information contained in this communication is highly confidential and is intended solely for the use of the individual(s) to whom this communication is directed. If you are not the intended recipient, you are hereby notified that any viewing, copying, disclosure or distribution of this information is prohibited. Please notify the sender, by electronic mail or telephone, of any unintended receipt and delete the original message without making any copies.
Blue Cross Blue Shield of Michigan and Blue Care Network of Michigan are nonprofit corporations and independent licensees of the Blue Cross and Blue Shield Association.
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar