Actual Problem with variables

B

bob

How do you pass a variable to a form that isn't open yet?
It works if both forms are open. If form one opens form
two with a "buttonclick" the variable does not get passed.
 
M

Marshall Barton

bob said:
How do you pass a variable to a form that isn't open yet?
It works if both forms are open. If form one opens form
two with a "buttonclick" the variable does not get passed.


Use the OpenForm method's OpenArgs argument to pass the
value (as a string) to Form2. Form2's Load event can then
use a line of code to save the value somewhere in itself:

something = Me.OpenArgs

While Access will probably convert the string in OpenArgs to
whatever type something is, it is better to explicitly
convert it. E.g.

something = CDate(Me.OpenArgs)
 

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