Connecting Tech Pros Worldwide Help | Site Map

Form level error handling

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 04:04 AM
John
Guest
 
Posts: n/a
Default Form level error handling

Hi

Is it possible to handle errors at form level that are not caught by the
error handlers within the form subs?

Regards



  #2  
Old November 13th, 2005, 04:04 AM
Tom van Stiphout
Guest
 
Posts: n/a
Default Re: Form level error handling

On Tue, 2 Nov 2004 12:45:58 -0000, "John" <John@nospam.infovis.co.uk>
wrote:

Will the Form_Error event work for you?
-Tom.
[color=blue]
>Hi
>
>Is it possible to handle errors at form level that are not caught by the
>error handlers within the form subs?
>
>Regards
>[/color]

  #3  
Old November 13th, 2005, 04:04 AM
deko
Guest
 
Posts: n/a
Default Re: Form level error handling

> Is it possible to handle errors at form level that are not caught by the[color=blue]
> error handlers within the form subs?[/color]

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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.