reference subform dynamically

  • 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?

  • Appologies for the late reply - been on a sabbatical. Did you get this issue resolved? If not, it should be possible to store the subform names and the different SQL strings in arrays and loop through the forms setting the record sources.

    Wendell
    Colorful Colorado
    You can't see the view if you don't climb the mountain!

  • Yes, I did resolve it...trial and error...then got it.

    thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply