VB for Office program flow question

G

Guest

I am not sure what happens to the calling programs when a new form is opened.

Does the closing of the new form return control to the routine that opened it?

What I have experience is the following:

1st call to the routine
code ....
open window and wait for user input
close input window
End routine

I expected the following to work
code ....
open window and wait for user input
close input window
code .... (run the rest of the routine)
End routine

What I actually see is
1st call to routine
code ....
open window and wait for user input
close input window
End routine

2nd call
code ....
open window
run the rest of the code from the original routine
wait for user input
do nothing with the new user input
close input window
End routine

DO i need to make the calling routine open a modal window?
What can I do to correct the flow of the routine?

Thanks in Advance
Jim Rendant
 
W

Wayne Morgan

To pause the code, the form needs to be opened with the acDialog window mode
argument in the DoCmd.OpenForm command. This will cause the code to pause
until the form is closed or hidden. I haven't tested opening a second pop-up
form from the first pop-up to see what would happen.
 
S

Sandra Daigle

Hi Jim,

I'm not sure why the first call to your form would be different than the
second. Regardless I think you want use the acDialog option of the
Windowmode parameter of the openform
command. This will suspend the calling code until the opened form is either
*hidden* or *closed*.

docmd.OpenForm "frmMyForm",,,,,acDialog
 

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