Hi folks, I have two forms, one of which calls a sub located in another.
My error handler on form1 does not seem to be handling errors that occur in the sub it called on form2.
Form1 code:
Private Sub Command1_Click()
On error goto Err_Command1_Click
Form2.Show
call Form2.GetRecord
Exit Sub
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
'clever code that logs the error
Msgbox "the following error occurred: " & err.description
Resume Exit_Command1_Click
End Sub
Form2Code:
Public Sub GetRecord
On error goto Err_GetRecord
'Many database operations here
Exit Sub
Err_GetRecord:
err.raise err.number,"form2_GetRecord",err.description
End Sub
The trouble is, that the err.raise statement doesn't send the error to the calling code on form1, it just throws a runtime error. Is this by design? Can error handlers defined on one form not catch errors occuring on another?
My error handler on form1 does not seem to be handling errors that occur in the sub it called on form2.
Form1 code:
Private Sub Command1_Click()
On error goto Err_Command1_Click
Form2.Show
call Form2.GetRecord
Exit Sub
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
'clever code that logs the error
Msgbox "the following error occurred: " & err.description
Resume Exit_Command1_Click
End Sub
Form2Code:
Public Sub GetRecord
On error goto Err_GetRecord
'Many database operations here
Exit Sub
Err_GetRecord:
err.raise err.number,"form2_GetRecord",err.description
End Sub
The trouble is, that the err.raise statement doesn't send the error to the calling code on form1, it just throws a runtime error. Is this by design? Can error handlers defined on one form not catch errors occuring on another?