error handler and routine

Cereldine

Registered User.
Local time
Today, 18:53
Joined
Aug 4, 2005
Messages
71
i have an error handler method that i have built that passes the error number & description and form.name to a global error handler.

It would be useful to expand this to include the sub/function that produced the error. Is their a generic way to refer to the sub/ routine that produced the error e.g. me.routine / me.sub / sub.name ? or do you just have to refer to it by its name. e.g

error_handler:
call errorlog(err.description, err.number, me.name, cmdinsert_click) ?
 
Sorry, you are stuck hard coding the name "cmdPrevious_Click()". I haven't completely explored MZ-Tools (free) but they might have something.
http://www.mztools.com/
 
Last edited:
what does the err.source return?
 
err.source returns the name of the Project Name as defined in the properties of the modules.

This is about the best you can do to display the basics...
Code:
Public Function TestErrorMessage()
On Error GoTo Err_TestErrorMessage

    Error 94 'force an error message

Exit_TestErrorMessage:
    Exit Function

Err_TestErrorMessage:
    MsgBox "Runtime Error # " & Err.Number & vbCrLf & "Description: " & Err.Description & vbCrLf & "Object Name: dProgramFunctions" & vbCrLf & "Source: " & Err.Source & vbCrLf & "Procedure: ErrorMsg" & vbCrLf & vbCrLf & "Please call Bill Gates if you need assistance.", 16, "ERROR - ErrorMsg"
    Resume Exit_TestErrorMessage

End Function
Experimentation is a great way to learn.
 

Users who are viewing this thread

Back
Top Bottom