> Is it possible to handle errors at form level that are not caught by the
error handlers within the form subs?
What kind of error?
Here's an error handling routine that has worked nicely for me - I use it on
every sub in the project
[code on Form]
Public Sub cmdProcName_Click()
On Error GoTo HandleErr
[code omitted]
Exit_Here:
On Error Resume Next
Exit Sub
HandleErr:
Select Case Err.Number
Case Else
modHandler.LogErr ("frm0"), ("cmdProcName_Click")
End Select
Resume Exit_Here
End Sub
[standard module modHandler]
Public Sub LogErr(fn, pn)
Dim strErrMsg As String
Dim strErrSrc As String
Dim strSql As String
strErrMsg = "Error Number " & Err.Number & ": " & Err.Description
strErrSrc = vbCrLf & vbCrLf & fn & "." & pn
MsgBox strErrMsg & strErrSrc, vbCritical, " Unexpected Error"
On Error GoTo Exit_Here
strSql = "INSERT INTO tblErrorLog ( [ErrMsg], [ErrFrm], [ErrPrc] )
VALUES (" & _
Chr(34) & strErrMsg & Chr(34) & ", " & Chr(34) & fn & Chr(34) & ", " &
Chr(34) & _
pn & Chr(34) & ")"
DoCmd.SetWarnings False
DoCmd.RunSQL strSql
DoCmd.SetWarnings True
Exit_Here:
Exit Sub
End Sub