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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refering to a field on a tab page

Status
Not open for further replies.

GirlBlonde

Programmer
Oct 30, 2007
94
AU
hi another question i am having difficulty with. i have a form with a tab control of 3 pages, how do i refer to a field on that tab? i want to automatically get the 2nd colum data from a cbo box. usually i would use the below code but it doesn't work. i know i need to refer to the page # and field but not sure how.

thanks anyone.

=Forms!Frm_Drivers!Cbodrivers17.Column(1)

Energy & persistance conquer all things!
 
You use the same syntax as if the tab didn't exist. So, if you are referring to a text box named Text1 on a tab named tabMain then you would just use:

Me.Text1

The tab control doesn't need to be referenced at any point unless you are coding for the tab itself.


Bob Larson
A2K,A2K3,A2K7,SQL Server 2000/2005,Crystal Reports 10/XI,VB6, WinXP, and Vista
Free Quick Tutorials and Samples:
 
Doesn't each tab contain a subform ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya GirlBlonde . . .

Also note: The [blue]Column[/blue] index includes any hidden columns (widths set to zero) in the [blue]Column Widths[/blue] property!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Hi Guys

thanks for all your replies.

My problem is as PHV said i want to refer to a cbo box on a tab that contains a sub form.

so for instance they select a name on the tab page and then refering to that value the sub form will populate using the selected response in the tab.

the tab has a cbo box and a sub form.

make sense, seems so easy and yet these little things seem to bug me.

many thanks guys.

Energy & persistance conquer all things!
 
With a subform the way to refer to the control is:

If the code is on the main form:

Me.YourSubformContainer.Form.YourComboBoxNameHere

If the code is on another subform:

Me.Parent.YourSubformContainer.Form.YourComboBoxNameHere


where YourSubformContainer is the name of the control that houses the subform on the parent form (which it is possible to have the subform container and the subform to have the same name, but it isn't always that way, so you have to use the container name and not the subform name).


Bob Larson
A2K,A2K3,A2K7,SQL Server 2000/2005,Crystal Reports 10/XI,VB6, WinXP, and Vista
Free Quick Tutorials and Samples:
 
GirlBlonde . . .
Code:
[blue]   [SubformName].Form!ComboboxName.Column(?)[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top