Microsoft Office Tutorials and References
In Depth Information
Recall that you removed the lookup feature from the CustomerID field because a
combo box provides the same lookup capability in a form. Next, you’ll add a combo box
for the CustomerID field to the custom form.
Adding a Combo Box to a Form
The tblCustomer and tblContract tables are related in a one-to-many relationship. The
CustomerID field in the tblContract table is a foreign key to the tblCustomer table, and you
can use a combo box in the custom form to view and maintain CustomerID field values
more easily and accurately than using a text box. Recall that a combo box is a control that
provides the features of a text box and a list box; you can choose a value from the list or type
You use the Combo Box tool in Design view to add a combo box to a form. If you
want help when adding the combo box, you can select one of the Access Control
Wizards. A Control Wizard asks a series of questions and then uses your answers to cre-
ate a control in a form or report. Access offers Control Wizards for the Combo Box, List
Box, Option Group, Command Button, Subform/Subreport, and other control tools.
You will use the Combo Box Wizard to add a combo box to the form for the
To add a combo box to the form:
1. In the Controls group on the Design tab, make sure the Use Control Wizards
button is selected.
2. In the Controls group on the Design tab, click the Combo Box button (with the
ScreenTip “Combo Box (Form Control)”). After you click the Combo Box tool or most
other tools in the Controls group, nothing happens until you move the pointer over
the form. When you move the pointer over the form, the pointer changes to a
shape that is unique for the tool with a plus symbol in its upper-left corner. You
position the plus symbol in the location where you want to place the upper-left
corner of the control.
You’ll place the combo box near the top of the form above the ContractType bound
control, and then position it more precisely after you’ve finished the wizard.
3. Position the + portion of the pointer three grid dots from the top of the grid and at
the 4-inch mark on the horizontal ruler, and then click the mouse button. Access
places a combo box control in the form and opens the first Combo Box Wizard dia-
You can use an existing table or query as the source for a new combo box or type
the values for the combo box. In this case, you’ll use the qryCustomersByName
query as the basis for the new combo box. This query includes the Customer calcu-
lated field, whose value equals the Company field value, if it’s nonnull, or the con-
catenation of the LastName and FirstName field values in all other cases.
4. Click the I want the combo box to look up the values in a table or query
option button (if necessary), click the Next button to open the next Combo Box
Wizard dialog box, click the Queries option button in the View group, click Query:
qryCustomersByName , and then click the Next button. Access opens the third
Combo Box Wizard dialog box. This dialog box lets you select the fields from the
query to appear as columns in the combo box. You’ll select the first two fields.