Creating a List Box or a Combo Box A list box or a combo box can come in handy if you find yourself repeatedly typing certain values into a field. For example, if you have to enter the name of one of your 12 branch offices each time you use a form, you might find it easier to create a list box containing the branch office names , and then you can click to select a particular name from the list. With a list box, the person doing the data entry is limited to the choices that display on the list. A combo box is useful when a list box is appropriate, but when it's possible that a different entry might occasionally be needed. For example, if most of your customers come from one of six states, but occasionally you get a new customer from another state, you might use a combo box. During data entry, you could choose the state from the list when appropriate and type a new state when it's not. Follow these steps to create a list box or combo box from Form Design view:
Tip Another Way to Enter Values List boxes and combo boxes can also be set up so that they pull their list of values from an existing table in the database (or a query that you've created). Select I Want the List Box to Look Up the Values in a Table or Query on the first wizard screen, and then specify the table or query that should supply the values for the list.
Figure 14.4. Type the values for the list or combo box.
Tip Tying a List or Combo Box to a Field The best way to approach list and combo boxes is to create a form that includes all the fields from a particular table. Then, you can delete the controls for fields in the Form Design view that you want to "re-create" as list or combo boxes. You then store the values from the list or combo box in one of the fields that you removed from the form.
Figure 14.5. Your list or combo box appears on the form grid.
Caution Where Are My Values? Don't be alarmed that the values you entered for the control don't appear in the box in the Design view. The values will be available when you switch to the Form view and do data entry on the form. Tip I Picked the Wrong Box Type! You can easily switch between a list box and a combo box, even after you create it. In Form Design view, right-click the control, click Change To from the shortcut menu that appears, and select a new control type. |
Team-Fly |
Top |