Adding controls to a form

  • Thread starter Thread starter g.vanswaaij
  • Start date Start date
G

g.vanswaaij

Hi everyone,

I am currently working on a database in which the results of an
extensive questionnaire will be stored. To facilitate adding or
removing questions later on, the form that has to be filled in is
dynamically generated.

Unfortunately, I'm quite new to VBA, and I can't find out how to add a
control to the Forms!FormName!Controls collection. According to the MS
VBA Reference, this collection has no Add function, so how else do I
have to do it? Adding them in the form design view, then setting their
visibility to false, and then letting the script switch the visibility
of the needed controls to true is not really an option, since there is
no way to tell in advance how many questions and possible answers will
appear on one page of the form.

Thanks in advance!
 
Hi everyone,

I am currently working on a database in which the results of an
extensive questionnaire will be stored. To facilitate adding or
removing questions later on, the form that has to be filled in is
dynamically generated.

Unfortunately, I'm quite new to VBA, and I can't find out how to add a
control to the Forms!FormName!Controls collection. According to the MS
VBA Reference, this collection has no Add function, so how else do I
have to do it? Adding them in the form design view, then setting their
visibility to false, and then letting the script switch the visibility
of the needed controls to true is not really an option, since there is
no way to tell in advance how many questions and possible answers will
appear on one page of the form.

Thanks in advance!

Your questions should be rows in a related table, Then you can
add/remove/change questions without it affecting the design of your form at
all. Even if you could easily add controls at runtime to an Access form you
will quickly hit a lifetime limit of 754 controls for the form.

I don't have the link handy, but search these groups for "at your survey".
It is an Access app that demonstrates a structure for creating flexible
surveys using Access.
 
Back
Top