Patrick O'Dea
asked on
Passing Variable From Menu Form
Hi,
I have a form which I use as a Menu to control my whole system.
So I have buttons on this form that call other forms.
For instance if I want choose the button "Add New Customers" this will call frmAddCustomers.
Requirement
I use the DoCMD.OpenForm to call frmAddCustomers. I want to pass the text "Add New Customers" to frmAddCustomers. I.e. What ever is held as the "caption" on the menu option should be passed to frmAddCustomers.
Essentially, the end result will be that whatever "caption" is held on the main menu will also appear as a heading on the form that is called.
So, if the menu says "Add New Customer" then this should also be what appears on the form that is called.
I have a form which I use as a Menu to control my whole system.
So I have buttons on this form that call other forms.
For instance if I want choose the button "Add New Customers" this will call frmAddCustomers.
Requirement
I use the DoCMD.OpenForm to call frmAddCustomers. I want to pass the text "Add New Customers" to frmAddCustomers. I.e. What ever is held as the "caption" on the menu option should be passed to frmAddCustomers.
Essentially, the end result will be that whatever "caption" is held on the main menu will also appear as a heading on the form that is called.
So, if the menu says "Add New Customer" then this should also be what appears on the form that is called.
ASKER
Thanks Erezmore,
I have done as you instructed ... and I am sure I am nearly there but...
... the actual wording does not appear on my form!
If I insert a text box onto my form how do I make this text box display the "openargs"?
Thanks again,
I have done as you instructed ... and I am sure I am nearly there but...
... the actual wording does not appear on my form!
If I insert a text box onto my form how do I make this text box display the "openargs"?
Thanks again,
ASKER
Just for the record Erezmore,
When I
msgbox me.caption
in the called form It DOES display the menu name from the menu.
...therefore we are nearly there.
When I
msgbox me.caption
in the called form It DOES display the menu name from the menu.
...therefore we are nearly there.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks folks - got it now
DoCmd.OpenForm "frmAddCustomres", acNormal, , , acFormAdd, acDialog, cmdAddCustomers.Caption '(you use the OpenArgs parameter to send the value)
then use the Open event of the form to set this parameter value as the form's caption:
Me.Caption = Me.OpenArgs
et voila!