How prevent form close when 'BeforeUpdate' cancelled

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

My form always shows a single record, it has two command buttons Cancel and
Save. When Save is clicked, my BeforeUpdate validations are done and I issue
'Cancel = True', however, the form still closes and the record is saved. What
can I put in my Save button procedure to prevent this? The procedure contains
DoCmd.Close.

Thanks.
 
The procedure contains DoCmd.Close.

DoCmd.Close doesn't belong in cmdSave_Click. Take it out.

Now then, we know when you *don't* want the form to close. When *do* you
want it to close?
 
I want it to close when the Save button is clicked and the Before Update
event is not cancelled but not when the Before Update event is cancelled.
 
If Not Cancel Then DoCmd.Close

--
HTH,
George


mscertified said:
I want it to close when the Save button is clicked and the Before Update
event is not cancelled but not when the Before Update event is cancelled.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top