Cancel form close

L

Les

When I close a form it checks to see if entries which have been made in two
sub-forms are correct. It then displays a message box if they are not.

How can I stop the close event and return the user to the form after they
have clicked ok in the message.
 
D

Dirk Goldgar

Les said:
When I close a form it checks to see if entries which have been made
in two sub-forms are correct. It then displays a message box if they
are not.

How can I stop the close event and return the user to the form after
they have clicked ok in the message.

You can't cancel the Close event. Do your checking in the Unload event
instead. The event procedure for the Unload event has a Cancel argument
that you can set to True to cancel the event, and thus prevent the form
from closing.
 
L

Les

Thanks for that problem now solved.

Les


Dirk Goldgar said:
You can't cancel the Close event. Do your checking in the Unload event
instead. The event procedure for the Unload event has a Cancel argument
that you can set to True to cancel the event, and thus prevent the form
from closing.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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