Stop VBA execution until form is closed

  • Thread starter Thread starter Bakema
  • Start date Start date
B

Bakema

Hi,

May this is simple, but I have failed so far.

I want to open a form programatically, and then stop
execution of the procedure for checking data in the form.
After closing the form (and loading some of the checked
data in public strings for use elsewhere) the procedure
should resume automatically and access the public strings
(for putting them in a Word document).
Opening the form is no problem, loading the form's data
to strings on closing works fine, but I did not manage to
making the procedure wait so that somebody can check and,
if necessary, edit the form's data.

Is this possible and if yes, how. If No is there a way
around this problem?

Bakema
 
The way that I usually do this is to open the form in
dialog mode. That causes all code to wait.

My close button doesn't close the form, just hides it so I
can still use the values elsewhere.


Chris Nebinger
 
Bakema said:
I want to open a form programatically, and then stop
execution of the procedure for checking data in the form.
After closing the form (and loading some of the checked
data in public strings for use elsewhere) the procedure
should resume automatically and access the public strings
(for putting them in a Word document).
Opening the form is no problem, loading the form's data
to strings on closing works fine, but I did not manage to
making the procedure wait so that somebody can check and,
if necessary, edit the form's data.


Open the form in Dialog mode:

DoCmd.OpenForm "nameofform", . . ., WindowMode:= acDialog
 
Adding the acDialog to the open string will pause the
running of the code following the openform until the
opened form closed.

DoCmd.OpenForm "form_name", , , , , acDialog
 
Back
Top