Close Pop Up

J

JMCS

A pop up is called from a main form button, and then populated initially from
the current record. The user can change some of the records data (only)
using the pop up. All working fine. However, I'd like to ensure that the
pop up closes as soon as it loses focus (or deactivates?) so that it does not
allow data to go back to the wrong record. I am just looking for a simple
coding solution, but using the pop up's "On Lost Focus" or "On Deactivate",
events, with code 'DoCmd.Close acform, "Form Name"' or 'DoCmd.Close' is not
working. Inserting "Stop" into the code is not working either.

Any help would be much appreciated.

JMCS
 
R

Rick Brandt

A pop up is called from a main form button, and then populated initially
from the current record. The user can change some of the records data
(only) using the pop up. All working fine. However, I'd like to ensure
that the pop up closes as soon as it loses focus (or deactivates?) so
that it does not allow data to go back to the wrong record. I am just
looking for a simple coding solution, but using the pop up's "On Lost
Focus" or "On Deactivate", events, with code 'DoCmd.Close acform, "Form
Name"' or 'DoCmd.Close' is not working. Inserting "Stop" into the code
is not working either.

Any help would be much appreciated.

JMCS

Instead of trying to make it close automatically, set its Modal property
to True. That will force the user to close it before they can do
anything else.
 
J

JMCS

Thank you, Rick - that solves the problem very neatly indeed. Job done!

Still, it would be really interesting to know why the "On Lost Focus" and
"On Deactivate" code was bypassed (the temporary 'Stop' was ignored, so it
wasn't going through it).

JMCS
 

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