Link to home
Start Free TrialLog in
Avatar of terpsichore
terpsichore

asked on

SQL recordsource - refer to control on the subform?

Dear experts,
I have an issue where my subform is pulling all records, and I just need to view one, which will change dynamically based on other factors.
I wanted to put an unbound control in the form HEADER, then requery the record source, setting one key field to the value of that control.
How do I do this syntactically?
The thing is that this subform appears in several places, so putting a literal string showing the parent is not ideal, as the parent will differ. Or do I create a string in the load event building this, based on what the parent form(s) are?
Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of terpsichore
terpsichore

ASKER

This works well.
I also am playing with Tempvars, as this will allow me to use the same variable name in both places.
You also can simply use a hidden control on the parent form and then simply set the master link property on the subform control to reference the hidden control.

Unlike the child link, the master link can refer to a field or control on the parent.  

Everything after that is automatic.

Jim.
Thank you both. I am tending to reprogram now and get rid of master/child links - I am finding much faster performance limiting the underlying recordset.