Locked lesson.
About this lesson
Create a form and combo box for easy data entry and storing numbers for foreign keys.
Exercise files
Download this lesson’s related exercise files.
Services_03_Start.accdb564 KB Services_03_End.accdb
592 KB
Quick reference
Create a Form and Combo Box
Application Terminology
Builder Button
The Builder Button is 3 dots to the right of a property. Clicking it launches a wizard to help fill the value for the property.
Change Control Type to a Combo Box
To change the control type to a combo box, right-click on it in Design View and choose Change to > Combo box.
Collapse or expand the Navigation Pane
Collapse or expand the Navigation Pane using the Shutter Button.
Collapse or expand the Ribbon
Double-click a ribbon name to collapse or expand the ribbon.
Column Count
The property specifying how many columns a combo box or listbox will have.
Column Widths
The property specifying individual widths of each column in a combo box or listbox. Separate column widths with semi-colon.
Combo Box
A combo box is a control that is a combination of a textbox that allows typing and a listbox showing a list of choices to pick from. Combo boxes provide a great way to show text for easy data entry while storing numbers behind the scenes for foreign keys.
The main properties to set for a combo box are:
- RowSource
- Column Count
- Column Widths
- List Width
Control
An object on a form or report such as a label, a line, a textbox, or a combo box.
Create a new form
To create a new form, select the table you want to base it on in the Navigation Pane. Click the Create ribbon and choose the form type you desire from the Forms group. To build a Multiple Items Form, click the More Forms down arrow.
Fieldlist
A list of fields in a table or query.
Foreign Key
A field (or combination of fields) in a table that relates to a primary key in another table. Foreign Keys are often single fields using a Long Integer data type that relate to an autonumber field in the main table.
List Width
The property specifying how wide a list will be when it drops down for a combo box. Add the column widths plus 0.2 inches (0.4cm) to allow for a scrollbar.
Multiple Items
A Multiple Items form shows several records per screen. Also called a continuous form.
Navigation Pane Shutter Button
The shutter button is an icon in the upper right of the Navigation Pane that you can use to collapse (<<) or expand (>>) the Navigation Pane.
Primary Key
A field (or combination of fields) in a table that has a unique value for every record. Primary Keys are often AutoNumber fields. AutoNumber is a special form of Long Integer that gets its value automatically.
Property
A characteristic of an object such as Name, Size, and Color.
Property Sheet
The Property Sheet shows detailed information about whatever is selected. In the design view of forms and reports, the property sheet is organized into categories for Format, Data, Event, Other, and All.
QBE grid
The Query By Example grid allows you to visually choose which fields you want to see, their order, and how they will be sorted and filtered.
Query
A query allows you to choose which fields you want to see from one or more tables and how they will be sorted.
Row Source
The property telling Access where a list will come from for a combo box or listbox.
Setting Properties for a Combo Box
The choices to display in the combo box are set in the Row Source property on the Data tab of the Property Sheet. Click the down arrow to choose a table or query name. Click the Builder button (…) for the Query Builder where you can choose fields, sort, and filter.
In the Query Builder, double-click fields from the fieldlist to put them on the grid. Sort data by the first field that shows. Click the Datasheet View icon to see the data. While looking at the data, determine column widths. When the builder is closed, the Row Source property of the combo box is updated with the SQL statement that defines where data will come from.
For a combo box, also set properties on the Format tab of the Property Sheet: Column Count, Column widths, and List Width. Press TAB to move to the next property. Use ; (semi-colon) to delimit numbers in the Column Widths property. The List Width is usually the sum of the column widths + 0.2 inches to allow for a scrollbar.
SQL
SQL is short for Structured Query Language. An SQL statement to show information starts with the word SELECT and tells Access which fields to get and how to sort them.
Subform
A subform is a special use of a form when it is contained on another form.
Views
To switch between Form View, Layout View, Design View, or to Save or Close, right-click on the form title bar. To maximize the form, double-click on its title bar.
You can also choose a view from the Views command on the HOME ribbon.
Steps
Create New Multiple Items Form
- To create a new form, select the table you want to base the form on in the Navigation Pane, and click on the Create ribbon.
- In the Forms group, click on the dropdown for More Forms and choose Multiple Items.
Change Text Box Control to Combo Box
- Right-click on the textbox control
- From the shortcut menu, choose Change To Combo Box
Change Row Source for Combo Box
- Select Combo Box Control
- On the Data Tab of the Property Sheet, click Row Source
- Click the Builder Button
- Make desired changes, Save, and Close
Basic Combo Box Properties
- Name
- Row Source
- Column Count
- Column Widths
- List Width
Lesson notes are only available for subscribers.