Error on Event Procedure

  • Thread starter Thread starter Tom Brown
  • Start date Start date
T

Tom Brown

I have a command button on a form that opens another form. Every time I use
it, I get an error. Here's the code

Private Sub CommandDataEntry_Click()
On Error GoTo Err_CommandDataEntry_Click

DoCmd.OpenForm "AlteonSim", acNormal

Err_CommandDataEntry_Click:
MsgBox Err.Description
Resume Exit_CommandDataEntry_Click
Exit_CommandDataEntry_Click:
End Sub

When I fire it, I get an error Box that has nothing in it except an OK
button. When I click the OK button, it says "Resume without error" and
another OK button.

Any help is always appreciated.

TIA,

Tom
 
You need to add the line:
Exit Sub
ahdea of the error handler.
Without it, the procedure opens the form, and then continues down until the
end of the proc, and so the error handler code runs even though there was no
error.
 
Thanks for the explanation Allen. I don't know 'jack' about programming
logic but somehow am able to get a few things done. I'll study what you
have said and maybe I will understand what's happening.

Now, if I can just figure out where the error handler is ............ <g>

Tom
 
Back
Top