We help IT Professionals succeed at work.

Dynamically add control to form after form is open.

ramrom asked
Medium Priority
Last Modified: 2008-02-01
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.
Watch Question

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]]]]]]])

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
And of course, you can open it in design mode:

docmd.openform "formname", acdesign
Database Developer
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.


Thank you. So sad. All my good work in FoxPro can't be easily ported to Access.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.