Need to know the name of the SubForm Object a form is in

Need to know the name of the SubForm Object a form is in

am 15.11.2007 17:55:04 von David Haskins

Hello,

I know that I can use the Parent property to get the name of the form
that a subform is on, but what if I need the name of the subform/
subreport "box" on that form that contains my subform? I've not found
a direct way to get that little nugget of information.

Thanks for your time,

David

Re: Need to know the name of the SubForm Object a form is in

am 15.11.2007 19:03:34 von bob.quintal

On Nov 15, 11:55 am, Dave wrote:
> Hello,
>
> I know that I can use the Parent property to get the name of the form
> that a subform is on, but what if I need the name of the subform/
> subreport "box" on that form that contains my subform? I've not found
> a direct way to get that little nugget of information.
>
> Thanks for your time,
>

> David

You'll need to iterate through the parent form's controls collection
for the object of type subform where its sourceobject is me.name

Dim n As Integer
For n = 0 To Me.Parent.Controls.Count - 1
If Me.Parent.Controls(n).ControlType = 112 Then
If Me.Parent.Controls(n).SourceObject = me.name then
Debug.Print "Success"
End if
End If
Next