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

Chapter 4. Simplifying Data Entry with Forms > Adding Controls to a Form

Adding Controls to a Form

Every form has three basic sections: Form Header, Detail, and Form Footer. When you use a wizard to create a form, the wizard adds a set of controls for each field that you select from the underlying table to the Detail section and leaves the Form Header and Form Footer sections blank. Because these sections are empty, Access collapses them, but you can size all the sections by dragging their selectors. Although labels and text box controls are perhaps the most common controls found in forms, you can also enhance your forms with many other types of controls. For example, you can add groups of option buttons, check boxes, and list boxes to present people with choices instead of making them type entries in text boxes.

The most popular controls are stored in the Toolbox. Clicking the More Controls button displays a list of all the other controls on your computer. The controls displayed when you click the More Controls button are not necessarily associated with Access or even with another Microsoft Office program. The list includes every control that any program has installed and registered on your computer.


Some controls, such as the Calendar Control, can be very useful. Others might do nothing when you add them to a form, or might do something unexpected and not entirely pleasant. If you feel like experimenting, don’t do so in an important database.

In this exercise, you will add a graphic and a caption to the Form Header section of the Customers form from the GardenCo database. You will also replace the Country text box control in the Detail section with a combo box control.

USE the GardenCo database and the tgc_logo2 graphic in the practice file folder for this topic. This practice file is located in the My Documents\Microsoft Press\Access 2003 SBS\Forms\Controls folder and can also be accessed by clicking Start/All Programs/Microsoft Press/Access 2003 Step by Step.

OPEN the GardenCo database and acknowledge the safety warning, if necessary.

Open the Customers form in Design view.

Point to the horizontal line between the Form Header section selector and the Detail section selector, and when the pointer changes to a double-headed arrow, drag the Detail section selector down a little over an inch.

If the Toolbox isn’t displayed, click the Toolbox button on the Form Design toolbar.

You can also open the View menu and select the Toolbox check box. To keep the Toolbox open but out of the way, you can drag it off to the side, and dock it on one edge of the screen.

To get an idea of the controls that are available, move the pointer over the buttons in the Toolbox, pausing just long enough to display each button’s ScreenTip.

Click the Image control in the Toolbox, and then drag a rectangle about 1 inch high and 3 inches wide at the left end of the Form Header section.

When you release the mouse button, Access displays the Insert Picture dialog box, in which you can select an image to insert in the control.

Navigate to the My Documents\Microsoft Press\Access 2003 SBS\Forms\Controls folder, and double-click tgc_logo2. (If you don’t see this file listed, change the Files of type setting to Graphics Files.)

The Garden Company logo appears inside the image control.


If the control isn’t large enough, the image is cropped. You can enlarge the control to display the entire image. (You might also have to enlarge the Form Header section.)

To add a caption to the header, click the Label control in the Toolbox, and then drag another rectangle in the header section.

Access inserts a label control containing the insertion point, ready for you to enter a caption.

Type the caption Customers, and press .

The Customers label takes on the formatting of the other labels.

With the Customers label selected, press the key to display the Properties dialog box.

Change the Font Size property to 18, and change the Text Align property to Center. Then close the Properties dialog box.

On the Format menu, point to Size, and then click To Fit.

Adjust the size and position of the two controls you added so that they are side-by-side.

If the Control Wizards button is active (orange) in the toolbox, click it to deactivate it.

With the Control Wizards button turned off, you can create a control with all the default settings without having to work through the wizard’s pages.

Insert a combo box in the Details section by clicking the Combo Box control in the Toolbox and then dragging a rectangle just below the current Country text box.

When you release the mouse button, Access displays a combo box control, which is unbound (not attached to a field in the Customers table).


Access provides a number for each control as it is created, so don’t be concerned if the number displayed in your control is different from what you see in the graphics in this book.

Copy the formatting of the Country text box to the new combo box control by clicking the Country text box, clicking the Format Painter button on the Form Design toolbar, and then clicking the combo box control.

Both the combo box control and its label take on the new formatting.

Right-click the combo box and click Properties on the shortcut menu to display the Properties dialog box.

Click the Data tab, set the Control Source property to Country, and then type the following in the Row Source box:

SELECT DISTINCT Customers.Country FROM Customers;

(Note that there is no space between Customers and Country; there is only a period. There is also a semi-colon at the end of the text.)

This line is a query that extracts one example of every country in the Country field of the Customers table and displays the results as a list when you click the box’s down arrow.

(You might have to widen the Properties dialog box to display the whole query.)


If you need to add a new customer from a country that is not in the list, you can type the new country’s name in the combo box. After the record is added to the database, that country shows up when the combo box list is displayed.

If necessary, set the Row Source Type to Table/Query.

Click the label to the left of the combo box (if necessary, drag the Properties dialog box to see the combo box label). Then click the dialog box’s Format tab, change the caption to Country, and close the dialog box.

Delete the original Country text box and its label, and move the new combo box and label into their place, resizing them as needed.

Click the View button to see your form.

Scroll through a couple of records, and display the combo box’s list to see how you can select a country.

You don’t need the record selector—the gray bar along the left edge of the form—so return to Design view, and display the Properties dialog box for the entire form by clicking the Form selector (the box at the junction of the horizontal and vertical rulers) and pressing . Then on the Format tab, change Record Selectors to No. While you’re at it, change Scroll Bars to Neither. Then close the Properties dialog box.

Save the form’s new design, and switch to Form view for a final look.

Close the form.

CLOSE the GardenCo database.

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