SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reference subform on a Tab control


Reference subform on a Tab control

Author
Message
GrassHopper
GrassHopper
SSC Veteran
SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)

Group: General Forum Members
Points: 279 Visits: 537
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



GrassHopper
GrassHopper
SSC Veteran
SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)SSC Veteran (279 reputation)

Group: General Forum Members
Points: 279 Visits: 537
I found the correct syntax:

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



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search