• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Working with Forms > Creating a Drop-Down Data-Entry List

Creating a Drop-Down Data-Entry List

Two of the more useful controls in the Tool box are the List Box and Combo Box. List Boxes present users with a list of values you derive from a table or query. Combo Boxes are, as the name implies, combinations of List Boxes and Text Boxes. Not only can users pick from a list of values, but they can enter their own values as well. The List Box and Combo Box Wizards are very similar, so we've used one procedure to describe them both.

To create a drop-down data-entry list:

1.
Click either the List Box or Combo Box button in the Toolbox and click the spot where you want it to appear on your form ( Figure 4.21 ).

Figure 4.21. Click the List Box icon or the Combo Box icon to create the drop-down data-entry list of your choice.


Make sure the Control Wizards button is depressed, or you will be when the wizard doesn't start.

2.
When the wizard appears, you must choose whether to enter your own values or draw data from a table or query. To get your values from a table or query, click the first option button and click Next ( Figure 4.22 ).

Figure 4.22. You can input your own values for your drop-down list.


or

If you want to enter your own values, select the second option and click Next. A screen appears asking you to input the values you want. When you've finished entering the values, click Next and skip to step 7.

3.
You can view your queries, tables, or both by clicking the appropriate option button. Click the table or query that you want to provide the contents of your box.

4.
From the list of fields that appears ( Figure 4.23 ), select the field you want and click the > button to add it to your box. Click Next to continue.

Figure 4.23. Add fields to your list with the >, >>, <, and << buttons.


5.
The next screen lets you adjust your column width. Drag the edge of the column until it's in the right spot; if you want Access to find the best fit, double-click the right edge. Click Next when you're done. ( Figure 4.24 ).

Figure 4.24. You can resize your list window to make its contents more readable.


6.
Type a name for your box in the space provided and click Finish.

Tip

If the values you want to include in your list are scattered among a few tables, you can create a query to gather them in one place (see Chapter 5).


Tip

To avoid duplicate values in your list, you should pick a key field in the table or query that you choose. You can add more than one field if you want, but one of the fields should be a key field.


Tip

To change a List Box into a Combo Box, choose Format > Change To. From the Change To submenu, select Combo Box. This technique works to change other objects'types as well; the Change To submenu will display the available types.


  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint