Jumat, 08 November 2013

RE: [MS_AccessPros] RE: Suppress Open Form Action Cancelled Message

 

I found it! The error was raised when the call stack returned to the click event for the button that issued the open form command. I placed the select case check for the error number there and now the second message does not appear.

 

Darrell

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Embrey, Darrell
Sent: Friday, November 08, 2013 11:56 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] RE: Suppress Open Form Action Cancelled Message

 

 

Thanks Bill,

 

I put an error trap in the Form Open event and placed a breakpoint on the message. The error trap doesn't process after I click the OK button on my no records to display message. I'm using Access 2007.

 

Darrell

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of wrmosca@comcast.net
Sent: Friday, November 08, 2013 11:49 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] RE: Suppress Open Form Action Cancelled Message

 

 

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.

 

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.


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 (4)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar