Creating a List Box or a Combo Box


10 Minute Guide to Microsoft Access 2002
By Joe Habraken
Table of Contents
Lesson 14.  Adding Special Controls to Forms

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:

  1. Make sure that the Control Wizards button on the Toolbox is selected.

  2. Click the List Box or Combo Box button in the Toolbox. The mouse pointer changes to show the type of box you selected.

  3. Drag your mouse todraw a box on the grid where you want the new element to be placed. When yourelease the mouse button, the list or combo box wizard starts.

  4. On the wizard's first screen (see Figure 14.3), click the option button I Will Type In the Values That I Want . Then click Next .

    Figure 14.3. The wizard walks you through the steps of creating a list box or a combo box.


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.

  1. On the next screen, a column of boxes (only one box shows before you enter your values) is provided that you use to enter the values that you want to appear in the list. Type them in (as shown in Figure 14.4), pressing the Tab key after each one. Then click Next .

  2. On the next screen, you choose the option of Access either remembering the values in the list for later use (such as in a calculation) or entering a value selected from the list in a particular field. Because you are using this box for data entry, select Store That Value in This Field , and then choose a field from the drop-down list that is supplied. For example, if you want this list to provide data from your Product Description field, select it in the drop-down list. Click Next to continue.

Figure 14.4. Type the values for the list or combo box.


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.

  1. On the next screen, type the label text for the new list or combo box control.

  2. Click Finish. Your new list or combo box appears on your form (see Figure 14.5).

Figure 14.5. Your list or combo box appears on the form grid.


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.


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.


10 Minute Guide to Microsoft Access 2002
10 Minute Guide to Microsoft Access 2002
ISBN: 0789726319
EAN: 2147483647
Year: 2000
Pages: 160
Authors: Joe Habraken © 2008-2017.
If you may any questions please contact us: