Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab control reference?

Status
Not open for further replies.

bjdobs

Programmer
Mar 11, 2002
261
CA
Not sure how to fix this ... I need to reference a control value from a parameter query ... as pointed out in a previous thread a query does not know how to use the "me" option so it either needs an absolute reference or a getvariable function call.

I have a Main Form with a Tab Control that has 10 tabs ... each tab has a subform with embedded controls

I successfully completed my tab 0 subform queries using the following reference;

Forms!<MainFormName>!<SubFormName>.Form!<ControlName>

Hoewever when I use this same code with the subform on tab 1 the reference is no longer being found at run time

I suspect the tab conrol container needs to be told to look for the subform on another tab ... syntax anyone?

I think my confusion is who owns the subform ... is it the form or the tab control?

 
I put a breakpoint on my requeryfunction and did a trace in the watch window for the Main Form (Forms!Main)... The subforms are all part of the Main Form object (which answers my last question) ... the reason the reference broke was when I put the subform onto the Tab page I changed the name (this showed up in the item list for the Main Form ... once I corrected the subforms's name the Queries started to work.

So no change is syntax is required ;)
 
bjdobs

Have you tried using the Me reference

Me.ControlName

For example, for...
Forms!<MainFormName>!<SubFormName>.Form!<ControlName>
You can use
Me.SubFormName.Form.ControlName
or
Me.SubFormName.Form!ControlName

To reference the parent from a subform, use the Parent
Me.Parent.ControlName
or
Me.Parent!ControlName

To reference another subform from a subform...
Me.Parent.Your2ndSubformName.Form.ControlName

Richard
 
Thanx Richard ... as I stated in my 1st message Me cannot be used in a paramater Query ... according to what I have read the jet database engine doesn't know how to resolve this reference ... Me does work if you choose to not use a Query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top