From a recent thread ...
Newsgroups: microsoft.public.access.modulescoding
Subject: Re: Creating controls on a page object
Date: Sun, 17 Jul 2005
Public Sub TestSub4()
Dim frm As Form
Dim tbc As TabControl
Dim pge As Page
Dim txt As TextBox
DoCmd.OpenForm "Form2", acDesign
Set frm = Forms("Form2")
Set tbc = frm.Controls("TabCtl0")
Set pge = tbc.Pages.Add()
pge.Name = "MyNewTabPage"
pge.Caption = "My New Tab Page"
CreateControl frm.Name, acTextBox, _
acDetail, pge.Name, "=Now()", _
pge.Left + 50, pge.Top + 50, 2000, 250
DoCmd.Close acForm, "Form2", acSaveYes
End Sub
Thanks, but...
> DoCmd.OpenForm "Form2", acDesign
...sorry, dude. I have to move the goalpost. I need the feature in running
mode, not design mode. (Like all the other TabControls on the planet...)
I suspect, per other threads, that I can't do that, and I am expected to use
a function like yours, at design time, to blast in a thousand tabs, make
them all invisible, and visible the populated ones at runtime.
What I actually need is a "filmstrip" control, like the one in the Windows
Explorer. So what I will eventually do is put 10 pages into a virtual
TabControl, and repopulate the labels as the users navigate back and forth.
> CreateControl frm.Name, acTextBox, _
> acDetail, pge.Name, "=Now()", _
> pge.Left + 50, pge.Top + 50, 2000, 250
CreateControl was the missing function! Now I remember using it 8 years ago.
Friggin' Alzheimers...

Signature
Phlip
http://www.c2.com/cgi/wiki?ZeekLand
Brendan Reynolds - 29 Jul 2005 11:38 GMT
You're right - you can't do that.
Controls can only be created in design view. Also, there's a limit of 754
controls or sections added over the lifetime of the form, which you'd
eventually hit if you created controls each time the form was opened.
You'll need to create the maximum number of controls you may ever need at
design time, and toggle their visibility at run time.
I've read that if you open a form in design view, create controls, switch to
form view, and then when closing the form do not save the new controls, they
do not count toward the 754 limit. But I have not tried this myself. The
form would still have to be opened in design view first, which means that it
will not work in an MDE, or using a runtime installation, or where the user
does not have change design permission on the form.

Signature
Brendan Reynolds (MVP)
> Thanks, but...
>
[quoted text clipped - 20 lines]
> ago.
> Friggin' Alzheimers...