Microsoft Office Tutorials and References
In Depth Information
Chapter 3: Creating Smarter Forms
For an order-entry database, for example, you may want a combo box that
lists the states and provinces in the United States and Canada. You have
a table called StateLookup with a field for the two-letter abbreviations, a
field for the full names of the states and provinces, and a field for the
salestax rate you need to charge for orders from that state. You can have your
combo box or list box display only the state or province name on the form,
but have the control store only the abbreviation for the selected state or
province in the order-entry table that you’re editing.
Making combo boxes the really easy way
In the table that’s the record source for the form, you can set up a field as
a lookup field — a field that must match the primary key field in a table of
codes. If you do this, Access creates a combo box when you drag it from the
field list to the Design View window of the form. Easy enough! By configuring
the field as a lookup field, you’ve already told Access what table and field to
use for the list of values. In the order-entry database example, when you set
up the Customers table, you’d configure the StateOrProvince field as a
lookup field that must match values in the StateLookup table.
To find out how to make a lookup field, see Book II, Chapter 5.
Running the Combo Box and List Box wizards
To make a combo box or list box when you didn’t designate the field as
a lookup field, a wizard steps you through the process. Before you start,
determine where the list of values comes from, as described in “Creating
and Configuring Combo and List Boxes,” earlier in this chapter. The Combo
Box and List Box wizards ask the same questions that we pose, so you’d
better have the answers. In this section, we describe the Combo Box Wizard,
because combo boxes outnumber list boxes 10 zillion to one in actual use,
but the List Box Wizard is similar.
To create a combo box with the Combo Box Wizard, follow these steps:
Book IV
Chapter 3
1. Open the form in Layout or Design view.
If either Layout or Design view is new to you, jump back to Chapter 1 of
this minibook for an overview.
2. Click the Combo Box button in the Controls group on the Design tab
of the Ribbon.
If you don’t see the Combo Box button, click the Controls button and
choose the Combo Box button from the drop-down menu.
3. Click the place in the form where you’d like the top-left corner of the
combo box to appear.
A plus sign appears on the form with a little combo box icon beside it,
marking the spot. Don’t worry if the combo box isn’t in exactly the right
spot; you can always move the edges later.
Search JabSto ::

Custom Search