I have a form that has a Tab Control with 10 tabs. Each tab has a subform. I am dynamically creating these forms from template forms I have. I make a copy of the main form and 10 subforms that are in each tab. I want to be able to rename the sourceobject of each subform in each tab. I tried renaming the sourceobject and Name of the subform from the main form, but It is not working. I think I need to put the Tab control name somewhere in here but not sure where?
MyFormName = The name of the main form
MyTemplateName = The current name of the subform
mysubformsNew = The New name of the subform I want to give to the subform
'The name of my Tab Control is "TabMain"
'This is what I am trying
Forms(MyFormName).Controls(MyTemplateName).Form.SourceObject = MySubFormsNew
Forms(MyFormName).Controls(MyTemplateName).Form.Name = MySubFormsNew