Basic Error Trapping Question

P

Paolo

Hi,

I use a sub in a separate module to call whenever I have an OnError.
This works fine. It even works if I set an error trap in the sub
itself (the one that is called). How is this possible? If an error is
generated by the calling sub, won't the called sub pick up on this
error and process it? It doesn't. The called sub processes the error
through my case statements. The only thing I notice is that the
err.description is missing if the calling sub produces an error. Here
is the code for the called sub:

Public Sub Handle_Error_Find(Error As Integer, exp As String, _
SubEvent As String, FormInfo As Form)
On Error GoTo ErrHandler
Select Case Error
Case 3200
MsgBox exp & " is referenced in another form!", vbCritical,
_
"Referential Integrity Error"
FormInfo.Undo
Case 3022
MsgBox exp & " cannot have duplicate values!", vbCritical,
_
"Duplicate values"
Case Else
MsgBox "Error in " & SubEvent & " ." & vbCrLf & vbCrLf & _
"Error #" & Error & vbCrLf & vbCrLf & Err.Description
MsgBox Err.Description
End Select
Handle_Error_Find_Exit:
Exit Sub
ErrHandler:
MsgBox "Error in Handle_Error_Find(Error As Integer, exp As String,"
& _
"SubEvent As String, FormInfo As Form)." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
Resume Handle_Error_Find_Exit
End Sub

Thanks!
Paolo

Note I only check this e-mail: (e-mail address removed), removing the
NOSPAM
 

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

Top