Modal

B

Bob Parr

Is there a way to open a form where the original form has to wait for the
new form to close before continuing. Also is there a way to pass a variable
to a form when it is called?

Thanks,
Bob
 
R

Rick Brandt

Bob Parr said:
Is there a way to open a form where the original form has to wait for the
new form to close before continuing. Also is there a way to pass a variable
to a form when it is called?

The OpenForm method of DoCmd has two optional arguments "WindowMode" and
"OpenArgs". Using the constant acDialog for the WindowMode causes it to pause
the calling code until the form is either closed or hidden. You can pass any
string you like as the OpenArgs argument and this will be available in the form
being opened by accessing the OpenArgs property of that form after it is opened.

DoCmd.OpenForm "SomeForm", , , , , acDialog, OpenArgs
 
J

Jim Allensworth

Is there a way to open a form where the original form has to wait for the
new form to close before continuing. Also is there a way to pass a variable
to a form when it is called?

Thanks,
Bob
Yes. You can use the OpenArgs argument of the OpenForm method for both
things.

docmd.OpenForm "frmBlat",,,,,,"frmToClose"

frmToClose would be the form opening the other form.

If you want to pass more than one value to the form then just separate
them with semicolons "frmToClose;AnotherValue"

Then you would parse them out in the opening form.


- Jim
 

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