Pass multiple variables from one form to another

  • Thread starter Thread starter Chuck
  • Start date Start date
C

Chuck

What would be the best way to pass multiple string variables from one form
to another? Is declaring the variables as global in the database's modules
sectino the only way?

Thanks
 
No, the easiest way is to let the second form directly reference a control
from the first form. The control can be hidden if necessary. Other options
are to use public variables in the form's class module. Then it can be
referenced as a property of the form. Last but not least, if you are trying
to pass parameters to a form when it opens you can use the OpenArgs
parameter of docmd.openform. Just string all the values together as a comma
(or some other character) delimited list. Then in the called form, use the
Split function to break the list into an array.

Tell more about your situation and I'll be glad to give more specific
information about the method that is most likely to satisfy your
requirements.
 
Thanks. I was using the OpenArgs method already but was splitting the
string with Left, Right, and Mid functions. I was not aware of the Split
function so I will give that a try.

Thanks


Sandra Daigle said:
No, the easiest way is to let the second form directly reference a control
from the first form. The control can be hidden if necessary. Other options
are to use public variables in the form's class module. Then it can be
referenced as a property of the form. Last but not least, if you are trying
to pass parameters to a form when it opens you can use the OpenArgs
parameter of docmd.openform. Just string all the values together as a comma
(or some other character) delimited list. Then in the called form, use the
Split function to break the list into an array.

Tell more about your situation and I'll be glad to give more specific
information about the method that is most likely to satisfy your
requirements.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

What would be the best way to pass multiple string variables from one
form to another? Is declaring the variables as global in the
database's modules sectino the only way?

Thanks
 
It was new in A2000 - just be sure to include the Compare parameter. This
parameter is optional but there is a known issue which is resolved when you
specify the parameter: http://www.trigeminal.com/usenet/usenet001.asp.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Thanks. I was using the OpenArgs method already but was splitting the
string with Left, Right, and Mid functions. I was not aware of the
Split function so I will give that a try.

Thanks


Sandra Daigle said:
No, the easiest way is to let the second form directly reference a
control from the first form. The control can be hidden if necessary.
Other options are to use public variables in the form's class
module. Then it can be referenced as a property of the form. Last
but not least, if you are trying to pass parameters to a form when
it opens you can use the OpenArgs parameter of docmd.openform. Just
string all the values together as a comma (or some other character)
delimited list. Then in the called form, use the Split function to
break the list into an array.

Tell more about your situation and I'll be glad to give more specific
information about the method that is most likely to satisfy your
requirements.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

What would be the best way to pass multiple string variables from
one form to another? Is declaring the variables as global in the
database's modules sectino the only way?

Thanks
 
Back
Top