Prevent a user from leaving a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform that causes a problem if the user leaves it (goes to another
form) before hitting the "Add" button to apply the information entered in the
subform. The simplest way I can devise to fix this problem is to not allow
the focus to change away from the window until the "add" button is hit.

I have been able to successfully do this by adding a macro to the Deactivate
property of the form. When the user moves off the form (deactivates it), the
macro gives a message that they must complete the form, and sends the user
back to the form. This works perfectly, the first time the user attempts to
leave the form, but if he tries again immediately, he can successfully change
focus to another form.

Is there an easier way to accomplish this that I am not aware of? Any
thoughts would be appreciated.
 
Why not just add the code associated with the "add" button to the forms EXIT
event or LOST FOCUS event?
 
This may work, especially if the Add button does some validation before
completion of the add command. I'll try it out.

Rick B said:
Why not just add the code associated with the "add" button to the forms EXIT
event or LOST FOCUS event?
 
Back
Top