Universal Error Tracking Within Form?

AggieLJ

Registered User.
Local time
Today, 08:14
Joined
Jan 9, 2009
Messages
30
I have made a public function that logs runtime errors.

Do I have to write a "On Error GoTo Err_SpecificProcedure" to call the function from EVERY procedure in EVERY form, or is there a way to write a "universal" function ONCE per form that will call my ErrorLog function from any procedure within that form?
 
I figured it out... I had totally forgotten about the Public Subs within a form...

Here is how I wrote it...

Code:
Public Sub ErrorCatch(strProcedure As String)

     Dim strModule As String
     
     strModule = "Form_frmCurrentStuff"
     
     'ErrorLog is the function I have to log errors.
     Call ErrorLog(Err.Number, Err.Description, strModule, strProcedure)


End Sub

Then in the individual procedures within the form I added:


Code:
Private Sub cmdWhatever_Click()
On Error GoTo Err_CmdWhatever

     .....
    
Err_CmdWhatever:

     Call ErrorCatch("cmdWhatever")
     Resume Next
     
End Sub
 

Users who are viewing this thread

Back
Top Bottom