An option group can be helpful in making Access client forms more user friendly when entering numeric values or yes/no fields. Notice the drop-down list shown here with numeric values that represent various types of customers:
Option groups may apply to toggle buttons, checkboxes, or radio buttons and work well if you don’t have a lot of options from which to choose. In this example, a lookup was previously created to look up the CustType from the CustomerTypes table. Notice that the text values are sorted in ascending order. We will create a mutually exclusive radio button, which will allow you to select only one value at a time for the customer type as you enter new customers into the Customers table.
Make sure the Use Control Wizards command is enabled in the Controls group, and a Wizard will begin taking you through the steps in entering the appropriate labels and numeric values. You will want to correctly match up each numeric value with the appropriate label.
Note: Remember that Option groups can only be bound to numeric or Yes/No fields. When storing values in Yes/No fields, the Yes value should be set to -1 and the No value should be set to 0.
As you progress through the Wizard, follow these steps:
- Type in the labels for each category (Corporate, Residential, Nonprofit).
- Choose whether you want one of the options to be a default choice.
- Assign a value to each label – making sure that these values match up correctly with the numeric values in the corresponding CustType field (1=Corporate; 2=Residential; 3=Nonprofit).
- Store the value in the appropriate field that contains the numeric values. In this case, the field was CustType.
- Choose the type of control you want – option button, checkbox, or toggle button. The option button is shown below. You may also choose a style.
- Give the option group a caption (Type of Customer).
- Click Finish.
(You may want to right-click on the control and set a background or fill color). The final result will look something like this: