VB Code:
'This would be how I would have a sub
Private Sub lblProgress1_Click()
On Error GoTo ErrHandler
'the code here for the sub
ErrHandler:
If Err.Number <> 0 Then
'Erl stores the actual line number of where the error occured
'which comes with MZTools
ErrorTrap Err.Number, Err.Description, Erl, Me.Name, "lblProgress1_Click"
Exit Sub
End If
End Sub
'This is how my errortrap looks
Private Sub ErrorTrap(ByVal Error As Long, _
ByVal sDescription As String, _
ByVal ErrLine As String, _
ByVal sForm As String, _
ByVal sFunction As String)
MsgBox "Error occured on form " & sForm & " in function " & sFunction & " on line " & ErrLine & vbCrLf & sDescription, vbOKOnly + vbCritical, "Error " & Error
End Sub