Add and Configure Controls Using Wizards

In addition to the command button wizards, you can use wizards to populate list boxes and combo boxes on your form. The Combo Box Wizard allows you to control the data within your combo box, as well as how the combo box is displayed. To launch the Combo Box Wizard, click the Combo Box icon in the Control Toolbox and click your form to place the combo box on your form. The first step of the Combo Box Wizard, shown in Figure 1-13, prompts you to choose where the data for your combo box comes from.

If you choose to type in the values you want, Access allows you to enter the data directly in the wizard. You can enter as many values as you need in multiple columns. Don't worry if you can't think of every option you want in your combo box, you can always go back and enter more options later.

If your combo box values are stored in a table or query, the second step of the Combo Box Wizard (shown in Figure 1-14) allows you to choose a table or query as the source of your combo box. Click Next to choose the fields in the table you want displayed in your combo box. The next step allows you to specify a sort order for your combo box. Click Next again to configure the column width of your combo box. Click Next one last time to give your combo box a label. Click Finish to save your combo box.

The Combo Box Wizard doesn't allow you to enter a name for your combo box. A generic name, such as Combo5 is used instead. As previously mentioned, it's best to rename your combo box with some sort of meaningful name such as cboProducts.

If you create a combo box on a form that displays records in a table or query, you can choose one additional option when creating your combo box. You can choose to find a record on your form based on the value selected in the combo box. If you do this, Access actually adds code behind your combo box.

0 0

Post a comment