The Check Box control provides an OnOff or YesNo choice

Figure 6.21 - A CheckBox control. To bind a CheckBox control to a field

1. Right-click the CheckBox control, and then click Properties on the shortcut menu.

2. On the Value page, do one of the following:

® Click New to create a new field. You can create a Yes/No, On/Off, True/False, or Icon field. When you select a

Yes/No field, the selected value appears in the cell in the folder. If you select Icon, the CheckBox icon appears in the folder as selected or cleared.

® Click Choose Field, point to User-Defined Fields In Folder, and then choose the field to which you want to bind the CheckBox control. In this example, the CheckBox control in Figure 6-21 is bound to the Corporate field.

The CheckBox control must be bound to a Yes/No field type for the check box to operate properly.

To set the initial value of a CheckBox control

1. Right-click the CheckBox control, and then click Advanced Properties on the shortcut menu.

2. Click the Value cell, and then type True.

3. Click Apply, and then close the Advanced Properties window.

ComboBox Controls

Use ComboBox controls so users can either choose a value from the list portion of the control or enter text in the edit box portion of the control, as shown in Figure 6-22. When working with the ComboBox control, you create the control, bind it to a field, and then specify the values for the items in the combo box list.

|— Users can type in the edit box portion of the control.

Users can select avalué from the lisi portion of the control.

Figure 6.22 - A Dropdown ComboBox control. To bind the ComboBox control to a field

1. Right-click the ComboBox control, and then click Properties on the shortcut menu.

2. On the Value page, do one of the following:

® To bind the ComboBox control to an existing field, click Choose Field, point to User-Defined Fields In Folder, and then click the field to which you want to bind the ComboBox control.

To select a list type

® In the List Type drop-down list box on the Value page, click either Dropdown or Droplist.

Outlook provides two types of combo boxes that you can use. You can set the combo style at design time on the Value page of the field's Properties dialog box, or you can set the style at run time by programmatically setting the Style property. The ComboBox also supports the same ListStyle property as the ListBox control. See the ListStyle table under "ListBox Controls" later in this chapter.

Figure 6.22 - A Dropdown ComboBox control. To bind the ComboBox control to a field

Style Description

DropDownCombo Users can either select a value from the list or type a new value in the combo box.

DropDownList Users must select a value from the list. Users cannot type a new value in the combo box.

To add values to the combo box list

® In the Possible Values text box on the Value page, type the values you want to appear in the list. Separate each value with a semicolon (;), as shown in Figure 6-23.

® You can also programmatically add items to the ComboBox. See Chapter 11 for examples. Use one of the following programmatic methods:

® The Addltem method allows you to loop through a collection and add the items one at a time. This method works well for a small number of items.

® The List and Column properties let you set or retrieve an array of values. List and Column properties are especially useful when you want to create multicolumn lists or combo boxes. If you assign a variant array to the List property of the control, you will enhance the performance of programmatically populating controls.

To set the initial value of a ComboBox control

® In the Initial Value text box on the Value page, type the value that you want to appear in the edit box portion of the control when the form first appears, as shown in Figure 6-23.

You can set the MatchEntry property to determine how a ListBox or ComboBox responds to user input at the keyboard. Use the Advanced Properties dialog box at design time to set the MatchEntry property for a selected control or programmatically set the property at run time.

Vba Multiple Choice Input Boxes

Figure 6.23 - Properties of a ComboBox control.

Set the Match Entry Property To

Was this article helpful?

0 0

Post a comment