AlanJordan
Programmer
I call the sub ErrBox (see below) using code similar to this:
Can anyone suggest a way to automatically include the name of the sub and the name of the form? I have a feeling that I need to create an add-in, but I'm not sure of how to do this in Access. I do not have VB installed in this location.
Thanks,
Alan
Code:
ErrBox ("The problem originated in ResetAdjustButton in frmEditHoursWorked_AWP")
Thanks,
Alan
Code:
Public Sub ErrBox(Optional varProblemType As Variant, Optional strUrgencyLevel As String, Optional dblNumRef1 As Double, Optional dblNumRef2 As Double)
'Note: The case functionality has been anticipated, but no differentiation is made yet.
Dim strMsg As String
If IsNull(varProblemType) Then 'there is a type of problem indicated
strMsg = "There is a problem. It is " & Err.Number & " - " & Err.Description & " - Source: " & Err.Source & "."
MsgBox strMsg
Else
Select Case varProblemType
Case "FL"
strMsg = "There is a problem. It is " & Err.Number & " - " & Err.Description & " - Source: " & Err.Source & "." _
& vbCrLf & vbCrLf & "Note: Tell a programmer that the problem originated while loading the form."
Case 1
strMsg = "There is a problem. It is " & Err.Number & " - " & Err.Description & " - Source: " & Err.Source & "."
Case 2
strMsg = "There is a problem. It is " & Err.Number & " - " & Err.Description & "."
Case Else
strMsg = "There is a problem. It is " & Err.Number & " - " & Err.Description & " - Source: " & Err.Source & "."
End Select
MsgBox strMsg
Call LogAMessage(strMsg, , CStr(varProblemType), "", dblNumRef1, dblNumRef2)
End If
End Sub