Full Version: Can't Reference Parent Source Object
UtterAccess Forums > Microsoft® Access > Access Forms

I am trying to reference a parent subform source object (I'm in a sub sub form) and keep getting Error # 2465. Description Application-defined or object-defined error.


Select Case Me.Parent.subform_Control_Name.SourceObject

Case "Subform 1" then ...

Case "Subform 2" then ...

End Select

What am I doing wrong????

First, are you sure your using the subform control's name? It's not necessarily the same name as the (usual) form.

You're wanting the parent subform's source object? The Source Object is a property of a subform control.
Me.Parent would refer to the parent subform
Me.Parent.Parent would refer tot the parent's parent form/subform.
Me.Parent.Parent!subform_Control_Name would refer to the subform control on the parent's parent.

Me.Parent.Parent!subform_Control_Name.SourceObject should refer to the source object of the subform control on the parent's parent.

or maybe you should try
Thanks azolder!

Me.Parent.Parent!subform_Control_Name.SourceObject worked!

This threw me for a loop. I was referencing the subform_control as Me.Subform_Control with in the subform. It never would have occured to me that I had to go to the Main form and reference from there.

This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.