Dynamically add control to form after form is open.

I have seen this question asked several times, and always the answer is NO. But I am stubborn, and come from other environments where it is easy to dynamically add controls.

I hope there is a way (Access 2000) to do this. Please help me find it. This is so important, as I specialize in dynamically growing forms.

Frustrated Fox.
LVL 17
ramromconsultant Asked:
Who is Participating?
 
Leigh PurvisDatabase DeveloperCommented:
Obviously if you deploy mde's though - you can't add controls (as you can't open a form in design mode).
The usual Access workaround is to provide as many hidden controls as could ever be required on the form - setting them a visible and positioned as required.
Admittedly - it's not as nice as spontaneous control arrays - but Access form controls aren't actual windows as in other environments.
Only the control which currently has the focus is a window in a real sense - the rest are effectively "paint on screen" up til that point - which Access uses as a means of keeping system resource use down.
0
 
thenelsonCommented:
Yes you can if the form is open in design mode.  Controls can be added only in design mode.  You use the CreateControl Method to do it:
CreateControl(formname, controltype[, section[, parent[, columnname[, left[, top[, width[, height]]]]]]])
0
 
dqmqCommented:
And of course, you can open it in design mode:

docmd.openform "formname", acdesign
0
 
ramromconsultant Author Commented:
Thank you. So sad. All my good work in FoxPro can't be easily ported to Access.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.