How prevent form close when 'BeforeUpdate' cancelled

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.
 
G

George Nicholson

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?
 
M

mscertified

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.
 
G

George Nicholson

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

Top