error handlers

  • Thread starter Rohan via AccessMonster.com
  • Start date
R

Rohan via AccessMonster.com

Do you need to put error handlers in for EVERY event code, or just button
click events ?

Rohan
 
D

david epsom dot com dot au

Rohan via AccessMonster.com said:
Do you need to put error handlers in for EVERY event code, or just button
click events ?

Rohan


Only if you are using Windows 2000 and A2000 before SP1.
In which case, an alternative fix is to apply all service
packs.

If you aren't having that problem, then error messages
automatically 'bubble up' to the calling function,
and trigger any error handler.

(david)
 
B

BruceM

I do not find default error handling to be especially useful, since it does
not necessarily identify the origin of the code that is triggering the
error. One approach I find helpful is to use generic names for Error and
Exit, rather than Form_Current_Err, etc. or whatever exactly Microsoft uses
by default with the wizard. With a minor modification the code can be
customized for any event. For instance, for the Form's Current event:

Private Sub Form_Current()

On Error GoTo ProcErr

' Your code

ProcExit:
Exit Sub

ProcErr:
msgbox "Error #" & Error.Number & ", " & Error.Description & " -
Form_Current"
Resume ProcExit

End Sub

The code can be pasted into the VB window, the end of the msgbox line
changed as needed, and then you can add your code where indicated. Any
error will include information about what triggered it.
 
Top