Error Handling in Access to Display Object Causing Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meichmann
    New Member
    • Oct 2013
    • 1

    Error Handling in Access to Display Object Causing Error

    Hello Everyone,
    I am receiving a "Error 446 - Object doesn't support named arguments", but I would like to see which object is actually causing the error. Is there any code I can add to my error handler that will display the object or function causing the error?

    thanks in advance
    Matt
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    The Source Property of the Err Object will return string expression specifying the name of the object or application that originally generated the error. You can use in an Error trap as such:
    Code:
    Private Sub cmdTest_Click()
    On Error GoTo Err_cmdTest_Click
    'Code here
    
    Exit_cmdTest_Click:
      Exit Sub
    
    Err_cmdTest_Click:
      MsgBox Err.Description & vbCrLf & "Error Source: " & Err.Source, _
             vbExclamation, "Error in Excel Transfer"
        Resume Exit_cmdTest_Click
    End Sub

    Comment

    Working...