How to refer to a subform within a subform from the parent form

rk2002

New member
Local time
Today, 01:27
Joined
Mar 8, 2004
Messages
8
I am trying to refer to a subform within a subform from my parent form how do i do this? Also i want to refer to my parent form from my subform and the subform within the subform.
Any suggestion would help!!!!
 
I keep meaning to write a FAQ on this, as I hate this topic....

To refer to a subform from a parent form, try:
Me("subForm1Name")
To refer to a control named txtTextBox on that subform:
Me("subForm1Name")("txtTextBox")

Just extend the syntax for more subforms. So if you have a subform called subsubForm on your subform:
Me("subForm1Name")("subsubForm")
and to refer to a control on that subsubForm:
Me("subForm1Name")("subsubForm")("txtTextBox2")

The above examples work because the default collection of the forms object is the controls collection, and the default property of the subform object is the Form property. If you really want to get technical and see the syntax in it's full glory, it would be:
Me.Controls("subForm1Name").Form.Controls("subsubForm").Form.Controls("txtTextBox2")

To refer to a parent form from a subform use:
Me.Parent
to refer to a control on that parent form:
Me.Parent("txtTextBox")

To refer to a parent form from a subform on a subform, just extend the syntax, using the Parent property:
Me.Parent.Parent("txtTextBox")
 
Last edited:
Problem solved!

Thanks i really needed that mate!!!!!!!!
 

Users who are viewing this thread

Back
Top Bottom