passing variables between several forms?

  • Thread starter Thread starter Jerome
  • Start date Start date
J

Jerome

(using Access 2003)

Hi,

How can I use, or access, variables on several forms?
I'll explain:
Form A has two buttons b1 and b2.
Both buttons open the same form B.
But I want form B to behave slightly different whether it's opened by b1
or b2.
How can I now send a value through the Click event of the button and get
it through the Load event of the second form?

I tried several things but they didn't work out.

Thanks a lot!

Jerome
 
Jerome said:
(using Access 2003)

Hi,

How can I use, or access, variables on several forms?
I'll explain:
Form A has two buttons b1 and b2.
Both buttons open the same form B.
But I want form B to behave slightly different whether it's opened by
b1 or b2.
How can I now send a value through the Click event of the button and
get it through the Load event of the second form?

I tried several things but they didn't work out.

Thanks a lot!

Jerome

The easiest is to use the optional OpenArgs argument for the OpenForm method.
The form thus opened can then refer to its own OpenArgs property to retrieve
that value.
 
docmd.OpenForm "aaaa",,,WhereCondition,,,OpenArgs
Use the openArgs To pass parameters,

docmd.OpenForm "aaaa",,,WhereCondition,,,"View"
On the on load property of the second form add the condition
If you have fiew parameters you want to pass
Select Case OpenArgs
case "View"

End Select
For One parameter
If OpenArgs="View" then
endif
 

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

Back
Top