Reference a control on a subform in a tab control!

jkfeagle

Codus Confusious
Local time
Yesterday, 19:09
Joined
Aug 22, 2002
Messages
166
OK. I have searched and searched and every thread dances around similar situations but none seem to address this particular one. I am trying to make a control on a sub form visible/not visible depending on the condition of a control on a main form. The catch is that the control I'm trying to change the state of is on a subform located in a tab control. I've tried a thousand combinations and none seem to work. How do I reference the control on the subform in a tab control?

Main Form: frmMemberMain
Tab Control: TabCtl12
Tab Control Page: 2
Subform: frmChildren
Control on subform: txtRelationship

Can someone please help before my brain explodes!! Thanks! :eek:
 
You don't have to worry about using the tab control name in your code as all controls are referenced from their form or subform. The fact that it is on a tab, for the code's sake is irrelevant. Make sure the subform CONTROL NAME, the name that it's named on the main form is used. Many times that is the same name as the subform, but it can be different if you differently named the control the subform sits in on the main form.
Code:
Forms!frmMemberMain.frmChildren.Form.txtRelationship
 
Thanks Bob. That did the trick. You da man! :D
 
I am not bumping this for new information. This is just to say thanks for an effective search engine. And yes I really do use it before I post any new questions!

Thank you again - Bob.
 
Thank you Bob for the help you Provided
I has taken me about 3 week to finally get an answer to the question I posed and this thread made it happen.
 
I am having a similar problem, but it is one step further. I have a sub-subform on what would be your frmChildren. How would I reference that?

Regards,
DLobs
 
I am having a similar problem, but it is one step further. I have a sub-subform on what would be your frmChildren. How would I reference that?

Regards,
DLobs

To reference a control the pattern for that is:

Forms!Mainform!Subform1.Form!Subform2.Form!ControlName

Note that Subform1 and Subform2 are the names of the subform controls and not the names of the forms in them but usually they have the same names,
 
To reference a control the pattern for that is:

Forms!Mainform!Subform1.Form!Subform2.Form!ControlName

Note that Subform1 and Subform2 are the names of the subform controls and not the names of the forms in them but usually they have the same names,


Ok. I have tried that and it still says that it can't find my "Subform1" which is names "Sam's Portfolio - All Information".

Here is what I'm working with...

Forms![Dashboard]![Sam's Portfolio - All Information].Form![Sam's CR Form].Form![Prospect Name] = Forms![Dashboard]![Sam's Portfolio - All Information].Form![Pref Mail Name]


Where I have my main form "Dashboard". Under a navigation tab I have created a subform "Sam's Portfolio - All Information" and in that I have another subform "Sam's CR Form". I'm trying to get the control reference "Prospect Name" on the form "Sam's CR Form" to equal the "Pref Mail Name" from the subform "Sam's Portfolio - All Information" via a command button.

I'm sorry that my naming conventions are a little odd as this is how it makes sense for my boss to read.

Thank you for your help!
 
If you are using a Navigation Form it has a subform (not really but they call it that) named as a default NavigationSubform. Did you rename that to Sam's Portfolio - All Information if not your reference should start with Forms![Dashboard]![NavigationSubform]


Could you upload you database. It would make this go faster.
 
Last edited:
I wish I'd thought to post that link...oh wait, I did! ;)

It appeared to me that he'd obviously missed it. :p Wouldn't be the first time someone missed a post in a thread.

Besides, he didn't mention the navigation control until afterward.
 
I changed Forms!Forms![Dashboard]![NavigationSubform] in my previous post to
Forms![Dashboard]![NavigationSubform] . Sorry about that.
 
I changed Forms!Forms![Dashboard]![NavigationSubform] in my previous post to
Forms![Dashboard]![NavigationSubform] . Sorry about that.

I got it! Thank you! I was definitely missing the "[NavigationSubform]" call, but what was also messing me up was that in the navigation form, the form linked to the tab is not technically a subform. Basically my issue was that I was trying to reference through the "Sam's Portfolio - All Information" form and it technically isn't considered a subform of the mainform "Dashboard" since it's what is bound to the tab. I knew you could ignore tabs, but I didn't know that the form bound to that tab isn't considered a subform and therefore doesn't need to be called.

Thank you all so much for working with me on this!:banghead:
 

Users who are viewing this thread

Back
Top Bottom