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!

Referencing subforms in Tab control

Status
Not open for further replies.

abenitez77

IS-IT--Management
Oct 18, 2007
147
0
0
US
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?

This code below is in a module (procedure)

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
 
but It is not working
Please, define 'not working'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It is not assigning the new name to the sourceobject and not changing the "Name" as well. No error msg's. When the code is done, it did not change it. The variables in my code have the correct values.


Forms(MyFormName).Controls(MyTemplateName).Form.SourceObject = MySubFormsNew
Forms(MyFormName).Controls(MyTemplateName).Form.Name = MySubFormsNew
 
I found the correct syntax:

Forms(MyFormName).Controls(MyTemplateName).SourceObject = MySubFormsNew
Forms(MyFormName).Controls(MyTemplateName).Name = MySubFormsNew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top