We help IT Professionals succeed at work.

Relative reference for sub sub sub from?

Ken Milam
Ken Milam asked
on
I have a form (1) that contains a sub-form (2), a sub-sub-form (3), and a sub-sub-sub-form (4).

I need to reference the value in a field (is this also called a control??) on (3) as a criteria in the query behind (4).  I tried the Me.Parent!ControlName nomenclature (Me.Parent![PartNumber]), but I'm not getting any effect,  

Is there a way to use some sort of relative reference for the query criteria behind (4)?

Thanks,
Ken
Comment
Watch Question

Software & Systems Engineer
Distinguished Expert 2019
Commented:
If you are working on VBA level (or create a small function)
you can reference any control easily like this:
Form_NameOfTheSubform.NameOfControl
Only needs the above form to have code behind (Design View -->View Code...and then close it)
In query level you need to work with Expression Builder (just right click on the control -->Control Source --> hit the 3 dots)
Ken MilamEngineer

Author

Commented:
Thanks, John,
So, what if I want to open a certain form combination where [Part Number] = 1234.  

I've got a button on an action button on form (Form_Select] that I'll use to open another form (Form 1] that will contain three nested sub forms

Form 1
 Sub Form 2
  Sub Sub Form 3
    Sub sub sub Form 4

Form 4 contains a control [PartNumber].  

I want to click a button on [Form_Select] to open [Form 1] the where PartNumber = 1234 on [Sub sub sub Form 4].


DoCmd.OpenForm "Form1", , ,"what goes here?"  


Thanks,
Ken
John TsioumprisSoftware & Systems Engineer
Distinguished Expert 2019

Commented:
I you can share a sample i think it would most helpful