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 on a Tab control Expand / Collapse
Author
Message
Posted Tuesday, July 8, 2014 9:36 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 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



Post #1590414
Posted Tuesday, July 8, 2014 12:58 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
I found the correct syntax:

Forms(MyFormName).Controls(MyTemplateName).SourceObject = MySubFormsNew
Forms(MyFormName).Controls(MyTemplateName).Name = MySubFormsNew



Post #1590475
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse