Stephan said:
yes. Using createControl.
During operation I automatically switch the form to design mode and switch
back once the create process is finished. That works nicely, only that I
now would like to add event reactions.
You're deluding yourself, that approach does not work
nicely. (I'm being blunt for the sake of emphasis, not to
belittle your knowledge.)
The CreateControl function's purpose is for use in design
time wizards and has no other rational use.
Design changes, especially large objects such as forms and
reports, affect a large part of the mdb file, which in turn
greatly increases the chances of corruption. It also causes
massive bloat, and because of the lifetime limit of 754
controls on a form/report will eventually fail. Not only
that, but if you should ever decide to make your app an mde,
it just plain will not work at all.
I've been down this road and I wish I had had someone around
to point me down a better path without having to suffer
through all the troubles it caused me. Please believe me,
it really is far better, as well as easier, to make
precreated controls visible than to deal with the
consequences of making design changes at runtime.