Hi everyone, hope you can help me here.
I have a form which I use to add records with two buttons used to exit, 'add' and 'cancel'. I have two problems.
1) If I click cancel, you get the 'is it OK to delete record?' Yes/No box. Clicking Yes is fine but if the user clicks No I get "run-time error 2501 The DoMenuItem action was cancelled". Does anyone know a simple way to stop this dialog box from appearing?
2) This one is more important (so why didn't I mention it first?!). I need the form to appear without the max min and close buttons, i.e. as a popup. The only problem is that if I set it to be a pop-up window I get an error when trying to cancel. It's the same error as above (DoMenuItem action as cancelled). This is the code I use on the cancel button:
Private Sub cancel_Click()
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Forms![add_nav].SetFocus
Forms![add_nav]!SysList.Requery
Forms![add_nav]!SubList.Requery
Forms![add_nav]!PlantList.Requery
DoCmd.Close acForm, "add_item"
End Sub
Can anyone think why this is causing an error *only* if used on a popup form.
Thanks for your time everyone,
Jordan
I have a form which I use to add records with two buttons used to exit, 'add' and 'cancel'. I have two problems.
1) If I click cancel, you get the 'is it OK to delete record?' Yes/No box. Clicking Yes is fine but if the user clicks No I get "run-time error 2501 The DoMenuItem action was cancelled". Does anyone know a simple way to stop this dialog box from appearing?
2) This one is more important (so why didn't I mention it first?!). I need the form to appear without the max min and close buttons, i.e. as a popup. The only problem is that if I set it to be a pop-up window I get an error when trying to cancel. It's the same error as above (DoMenuItem action as cancelled). This is the code I use on the cancel button:
Private Sub cancel_Click()
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Forms![add_nav].SetFocus
Forms![add_nav]!SysList.Requery
Forms![add_nav]!SubList.Requery
Forms![add_nav]!PlantList.Requery
DoCmd.Close acForm, "add_item"
End Sub
Can anyone think why this is causing an error *only* if used on a popup form.
Thanks for your time everyone,
Jordan