ControlType Property

Applies To

ActiveX control, Bound Object Frame control, Chart control, Check Box control, Combo Box control, Command Button control, Image control, Label control, Line control, List Box control, Option Button control, Option Group control, Page, Page Break control, Rectangle control, Subform/Subreport control, Tab control, Text Box control, Toggle Button control, Unbound Object Frame control.

Description

You can use the ControlType property in Visual Basic to determine the type of a control on a form or report.

Setting

The ControlType property setting is an intrinsic constant that specifies the control type.

Constant

Control

acLabel

Label

acRectangle

Rectangle

acLine

Line

acImage

Image

acCommandButton

Command button

acOptionButton

Option button

acCheckBox

Check box

acOptionGroup

Option group

acBoundObjectFrame

Bound object frame

acTextBox

Text box

acListBox

List box

acComboBox

Combo box

acSubform

Subform/subreport

acObjectFrame

Unbound object frame or chart

acPageBreak

Page break

acPage

Page

acCustomControl

ActiveX (custom) control

acToggleButton

Toggle button

acTabCtl

Tab


The ControlType property can only be set by using Visual Basic in form Design view or report Design view, but it can be read in all views.

Remarks

The ControlType property is useful not only for checking for a specific control type in code, but also for changing the type of control to another type. For example, you can change a text box to a combo box by setting the ControlType property for the text box to acComboBox while in form Design view.

You can use the ControlType property to change characteristics of similar controls on a form according to certain conditions. For example, if you don't want users to edit existing data in text boxes, you can set the SpecialEffect property for all text boxes to Flat and set the form's AllowEdits property to No. (The SpecialEffect property doesn't affect whether data can be edited; it's used here to provide a visual cue that the control behavior has changed.)

The ControlType property is also used to specify the type of control to create when you are using the CreateControl function.

See Also

CreateControl, CreateReportControl functions.

Example

See the AllowAdditions property example.