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

Reference Subform control to set property

Status
Not open for further replies.

dpimental

Programmer
Jul 23, 2002
535
US
I have 1 mainform, which has 5 subforms, representing the 5 days of the week (mon-fri).

I need to refernce 2 controls on any of the subforms, when the subform is not populated, to make the controls invisible.

How do I reference the controls on the subform, from the main form, to make the controls invisible when the subform does not contain any data. David Pimental
(US, Oh)
dpimental@checkfree.com
 
Hi!

To reference the controls on a subform you use the following syntax:

Me.NameOfSubformControl.Form.NameOfControlOnSubForm.Property

Where is says NameOfSubformControl, this is the name of the control on the main form, not the name of the subform.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Jeff is, as he always is here, spot on. One other thought that might help, though, is that it's possible to build that reference so that you can use a variable to change which of the subforms your code refers to, so you don't have to rewrite your code for each object.

That syntax would be:
Me(strNameOfSubformControl).Form.NameOfControlOnSubForm.Property

where strNameOfSubformContrl is a string variable that holds the name of the control in question.

Hope this makes sense, and is of some use.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top