See help on CreateControl
In general, this is only useful if you are creating some kind of wizard form
that creates whole forms for end users. You don't want to be creating text
boxes on the fly for a normal form.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
- Show quoted text -
It is my understanding that the CreateControl( ) function only works
in design view. If the intention is to populate a form with indexed
controls at run-time, then the controls must be created ahead of time
and named with the index in the name. They can be invisible until
they are needed. For example, if you created a series of labels named
LABEL1, LABEL2, LABEL3,etc., then they can be called later as if they
were "created", using the following syntax:
iLabelTally=1
me("Label" & format(iLabelTally).Top = iLabelTop
me("Label" & format(iLabelTally).Left = iLabelLeft
me("Label" & format(iLabelTally).Width = iLabelWidth
me("Label" & format(iLabelTally).visible = True
In versions of Access prior to Access 2007, the effective limit is
around 200 controls. The screen will hold 500+, but will slow down
appreciably. Access 2007 cannot handle (as of this writing) anywhere
near that number, as it takes 1 second to display and configure each
control. Thus 200 controls will take about 200 seconds to display on
my Pentium 4.