Sorry if this seems like a silly question but.....
I have a form which has various text input boxes. One of the inputs (along with one other field) makes up the primary key. I've set up a message box that prompts the user if an invalid ID has been input. This works fine. The message box has RETRY and CANCEL buttons. I've been able to get the retry to work without any problem - I just send the user back to the text box to have another go. For the cancel button though, I would like to close the form completely (and go back to a main menu when I set one up). When I try to do a
DoCmd.Close acForm, "Initial", acSaveNo
command I just get a
Run-time error '2585': "This action can't be carried out while processing a form or report event."
I've tried saving the record first, running the command from a module rather than inside the form code, saving the record then deleting it and lots more I can't remember. I feel like I must be missing something really obvious.
I hope this all makes sense (and it's an easy one...)
Thanks in advance,