Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reference the subform using variables

Status
Not open for further replies.

abenitez77

IS-IT--Management
Oct 18, 2007
147
0
0
US
I have a subform on a main form that I want to change the recordsource. I have some code that loops and does this for several subforms on the main form. I need it to by dynamically, so I want to use variables.

Below is how I would do it hard coded.
Forms!MyMainForm.[MySubForm].Form.RecordSource = "SubQryTab02"

I tried this for dynamically:
Forms(MyMainForm).(MySubForm).Form.RecordSource = MySubQuery

What is the correct syntax?

 
so it would be this?
Forms(MyMainForm).controls(MySubForm).Form.RecordSource = MySubQuery
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top