the subform control, i.e.:
Me.Controls("Sub1").Form
Another example:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Yes. Now I named my forms with exactly the same names (sub1, sub2 and
SomeTextBox), but it's not working.
Does this really work?
I try also with code:
Dim subF1 As SubForm
Dim subF2 As SubForm
Dim subF1Controls As Controls
'Dim
'MsgBox CStr(Now())
Set subF1 = Me.Controls("Sub1")
Set subF1Controls = subF1.Controls
Debug.Print subF1Controls.Count
Debug.Print CStr(subF1.Controls.Count)
Debug.Print subF1.Name
strTemp = CStr(TypeName(Me.Controls("Sub1")))
strTemp = strTemp & vbCrLf & Me.Controls("Sub1").Name
'strTemp = strTemp & ", " & CStr(Me.Controls("Sub1").SomeTextBoxSub1.Name)
Debug.Print strTemp
Debug.Print CStr(TypeName(Me.Controls("Sub1")))
But in the line:
Set subF1Controls = subF1.Controls
I get error:
Run-time error '2455'
You entered an expression that has an invalid reference to the property
Form/Report.
Do you know how I can reference to the subfrom object (sub1) (or on any
object ) and how I can reference to the subform object (sub2)
inside this subform (sub1).
Primoz Orehar; Slovenia, Europe
Did you replace "Sub1" with the name of your subreport control?
And Sub2 with the name of the lower level subreport control?
Please note that you need to use the Name of the subreport