There are 2 instances of subformA. The same button on each makes an instance of subformB visible (there are 2 instances of subformB).
Problem; how can I tell which instance of subformA’s button was pressed.
‘CodeContextObject.Name’ only gives the name of the subform, not the name of the subform control holding the subform.
To make reference easy (for me), here are the actual names of the subforms and their holding controls.
sub Form....................................................................Control name
frmSoARecomendedProducts....(instance1).................sfrmRecomendedProductsForMain
frmSoARecomendedProducts....(instance2).................sfrmRecomendedProductsForLinked.
Which instance of a form started action
-
- 5StarLounger
- Posts: 962
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Which instance of a form started action
Avagr8day, regards, Peter
-
- 4StarLounger
- Posts: 482
- Joined: 24 Jan 2010, 15:02
- Location: Colorado, USA
Re: Which instance of a form started action
I think I would look at using the tag of the subform control to store who did what. I assume you are hiding and making visible the subform control, not the actually subform.
Wendell
You can't see the view if you don't climb the mountain!
You can't see the view if you don't climb the mountain!
-
- 5StarLounger
- Posts: 962
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Re: Which instance of a form started action
Thanks Wendall.
But how do I tell which of the 2 subform holding controls was used? In other words in the 'On click' event of the button on the form, how does one determine what the tag of the control holding the subform is?
But how do I tell which of the 2 subform holding controls was used? In other words in the 'On click' event of the button on the form, how does one determine what the tag of the control holding the subform is?
Avagr8day, regards, Peter
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: Which instance of a form started action
So the button is on the subform?
If both the subform controls had the same name, but different tags you could use
Dim strTag as string
strTag = me.parent.sfrmRecomendedProductsForMain.tag
Then pass strTag to the form that was opened using OpenArgs.
If both the subform controls had the same name, but different tags you could use
Dim strTag as string
strTag = me.parent.sfrmRecomendedProductsForMain.tag
Then pass strTag to the form that was opened using OpenArgs.
Regards
John
John
-
- Administrator
- Posts: 78642
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Which instance of a form started action
The subform on which the user clicks the button is the active control on the main form, so to get the control name of the subform on which the button was clicked, you can use
Me.Parent.ActiveControl.Name
Me.Parent.ActiveControl.Name
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 962
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Re: Which instance of a form started action
John, thanks for that, but I don't know which of the 2 subforms is doing the calling.
Hans - you hit the nail on the head. That works a treat. thanks.
Hans - you hit the nail on the head. That works a treat. thanks.
You do not have the required permissions to view the files attached to this post.
Avagr8day, regards, Peter