error handlers

  • Thread starter Thread starter Rohan via AccessMonster.com
  • Start date 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
 
Only places in your code that might EVER encounter an error.
 
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)
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top