Modal

  • Thread starter Thread starter Bob Parr
  • Start date Start date
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
 
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
 
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
 
Back
Top