G
Guest
I have a form in which at times the user would want to cancel any of the data
that has already been entered. I created a Cancel button that has the
accompanying code. What is supposed to happen is the form that is open in add
mode is closed and not saved, then my main switchboard form is opened, but no
matter what, a new record is added to the Table that is associted with the
report. I think I've determined that it has something to do with a macro that
I'm running on the form that is being called by the OnCurrent event when it
is opened. I kind of need to have the macro run so is there another way of
making a cancel button work? I'm somewhat of a newbie to coding so bear with
me. Thanks in advance.
Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Click
DoCmd.Close acForm, "frmReport", acSaveNo
DoCmd.OpenForm "Main Switchboard"
Exit_Cancel_Click:
Exit Sub
Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click
End Sub
that has already been entered. I created a Cancel button that has the
accompanying code. What is supposed to happen is the form that is open in add
mode is closed and not saved, then my main switchboard form is opened, but no
matter what, a new record is added to the Table that is associted with the
report. I think I've determined that it has something to do with a macro that
I'm running on the form that is being called by the OnCurrent event when it
is opened. I kind of need to have the macro run so is there another way of
making a cancel button work? I'm somewhat of a newbie to coding so bear with
me. Thanks in advance.
Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Click
DoCmd.Close acForm, "frmReport", acSaveNo
DoCmd.OpenForm "Main Switchboard"
Exit_Cancel_Click:
Exit Sub
Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click
End Sub