Forum Discussion

Tony2021's avatar
Tony2021
Steel Contributor
Nov 18, 2022
Solved

Error Handling Question (dont see the debug button)

Experts,

I am adding error handling to my form.

I seem to not get the debug button anylonger with the below. 

I get a message box as I should but no button for debug. 

I am wondering how I can add error handling but also get the debug button in the msg box so I can see where the error is in the code.  

I am not showing the entire code that is between On Error GoTo EH and EH.

 

thank you

 

Private Sub txtAmountRoll_AfterUpdate()

 

 On Error GoTo EH

'code is here

 

EH: 'Add error handling here

If Err.Number = 3075 Then
Exit Sub
Else

If Err.Number = 0 Then
Exit Sub
Else
MsgBox "Error " & Err.Number & ": " & Err.Description
End If
End If

4 Replies

  • Hi,

     

    It is by design that you don't see the debug button when you do your own error handling and message.

     

    Workaround:

    When your error MsgBox comes up you can press Ctrl+Break to get into the code editor and current error handler. If you have added a line with

     

    Resume

     

    to the end of your error handler, you can drag the yellow error arrow to this Resume and then press F8 to jump to the code line where the error occured.

     

    Servus
    Karl
    ************
    Access News
    Access DevCon

     

    • Tony2021's avatar
      Tony2021
      Steel Contributor
      Hi Karl, thank you. correct me if I am wrong but if another user is using the database that doesnt know about that then I dont think they will ever know where the error line resides? I am thinking I will just remove the error handler.
      • Hi,

         

        You are correct and this is one of the purposes of custom error handling. The normal user shall NOT get into the code behind an application.

         

        Servus
        Karl
        ************
        Access News
        Access DevCon