UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Create New Subform Control Within A Tab Control Page - Via VBA, Access 2010    
 
   
adaytay
post Jan 5 2017, 04:54 AM
Post#1


UtterAccess VIP
Posts: 3,729
Joined: 7-October 03
From: Yorkshire, England.


Hey guys. Been a while...

Is there a way to place a new subform control *within a tab page* - using VBA? I'm creating content dynamically on the fly, and want a page to be added to a tab control, and then I'll add a subform container onto the newly added page.

Any info would be much appreciated. I'm sure I'll figure it out eventually, but a shove in the right direction would be awesome...

Thanks,

Ad

--------------------
Cheers,

Adz.
Go to the top of the page
 
adaytay
post Jan 5 2017, 04:59 AM
Post#2


UtterAccess VIP
Posts: 3,729
Joined: 7-October 03
From: Yorkshire, England.


I think as a temporary measure I'll create a load of pages and stick an unbound subform control in without a source object, and just populate on the fly. Will make things easier for the time being - however, if it is possible to dynamically add controls at run-time, please do let me know!


--------------------
Cheers,

Adz.
Go to the top of the page
 
JeffK
post Jan 16 2017, 01:55 PM
Post#3


UtterAccess VIP
Posts: 1,550
Joined: 19-December 02
From: Lansing, MI


You can create controls programmatically using the Application.CreateControl() method, but I believe the form has to be in design view for this to work. So I guess to make this happen at runtime you could close the form, open it hidden in design view, add the control, save, close and open in form view??? Because of the design view requirement this wouldn't work in an mde/accde, or with Access Runtime, or with a shared front end (eek).

CreateControl() has a Parent argument you can use to specify the name of the parent tab page.

I have a few tools that use CreateControl() but they're developer add-ins. For dynamic forms in standard applications designed for end users, I'd go with the dummy controls that get SourceObject, ControlSource, Visibility, etc. assigned at runtime.

Jeff
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd October 2017 - 08:35 AM