convert text box to combo box using code

T

TonyT

Hi Chris,

Me.myCtlName.ControlType = acComboBox / acTextBox

can be used only when the form is open in design view.

see ControlType in help for more details.

TonyT..
 
C

Chris

Thanks.

TonyT said:
Hi Chris,

Me.myCtlName.ControlType = acComboBox / acTextBox

can be used only when the form is open in design view.

see ControlType in help for more details.

TonyT..
 
K

Klatuu

You don't really want to do this. There is a limit of about 740 controls for
a form over it's lifetime. Changing the control type is the same as deleting
a control and adding a control. The problem is, deleteing a control does not
reduce the count, but adding a control does. That is why it is a "lifetime"
limit. Sooner or later, the form will become unusable.

An alternative would be to create a text box and a combo. Make one visible
and the other not visible. You can then programmatically show and hide the
two controls using the visible property. You do not have to be in design
mode, but when you make the change, neither should be the active control.
 
Top