dynamic add control in runtime

T

Thanh-Nhan Le

Hi everybody,

I have a universal form ("frmCommon") for viewing, editing all tables...
Each table had some special functions, form frmCommon should create, add
command buttons corresp. these functions.
- the DB will be MDE, I will not be able to change the Form in design mode
(and that is not good idie, I think)
- In VB we can add new control with command: controls.add(....), I though,
it is also possible in access.
- When it is not possible, I will build form more unvisible command buttons,
then set them visible as needed.

Thanks
Nhan
 
T

Thanh-Nhan Le

Hi everybody,

Can I in Acccess2k add a control to a form dynamically in runtime? How?

Thanks
Nhan
 
M

Marshall Barton

Thanh-Nhan Le said:
Can I in Acccess2k add a control to a form dynamically in runtime? How?


No, control creation is a design time operation. If you'll
explain what you are trying to accomplish, maybe we can come
up with an alternative approach. The usual is to have one
or more invisible controls on the form and make them visible
as needed.
 
K

Klatuu

It can be done, but it is a very bad idea, and will only bring you pain and
grief.
The first problem is, there is a lifetime limit of the number of controls on
a form. It is around 740. Each time you add a control, the count goes up by
one, but deleting the control does not reduce the count. Therefore, it will
not take long before the form fails because there are too many controls.

Also, to do this, the form has to be open in design mode to do this.

What are you trying to achieve? I am sure there is another way to do
whatever it is you need.
 
Top