Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

reference subform dynamically Expand / Collapse
Author
Message
Posted Friday, June 27, 2014 8:12 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 2, 2014 3:02 PM
Points: 171, Visits: 462
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?



Post #1586853
Posted Saturday, August 2, 2014 7:35 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 7:22 AM
Points: 170, Visits: 628
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!
Post #1598933
Posted Friday, August 8, 2014 1:26 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 2, 2014 3:02 PM
Points: 171, Visits: 462
Yes, I did resolve it...trial and error...then got it.

thanks



Post #1601320
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse