Chapter 8
In This Chapter
Creating forms the easy way with Form tools
Building a form with the Form Wizard
Adding the finishing touches
Managing Data in Form View
Access forms are similar to paper forms in their function — they’re used in part to collect data — but Access forms go beyond paper forms by having a direct connection to the database tables that store the collected information. In the “old days,” after you completed a paper form, some poor soul had to manually organize and file each form in a file cabinet or tabulate results by hand. With the advent of electronic databases such as Access, the data typed into an electronic form is simultaneously placed in the file cabinet (the table) connected to that form.
Like reports and queries, forms are named and stored in the database file. Forms are full-fledged Access objects, so you can customize them easily to meet the needs of your business.
This chapter shows what forms can do for you, shows you how to make forms, and provides tips for customizing forms so they’re exactly what you need.
Depending on your needs, you can create forms in three ways:
The Form Wizard and Form tools are a time-saving gift from your friends at Microsoft. Use them to create your forms. They do the hard stuff so all you have to do is provide the finishing touches.
I have good and bad news about these tools:
Bad news: They’re extremely inflexible buggers.
You want a larger font and a different background color? Keep it to yourself. The Form tools decide what font, colors, and layout you get.
To create a form using one of the Forms buttons, open your database and follow these steps:
Click the Create tab on the Ribbon.
Several button groups appear on the Ribbon, including the Forms group. (See Figure 8-1.)
Click the form button of your choice from the Forms buttons.
The Simple Form button is labeled Form. The Multiple Items and Split Form buttons are on the More Forms drop-down list.
The sidebar “Meet the Form tools” shows the best Form tool for your data.
A beautiful form appears before your eyes (and in Figure 8-2)!
To finish your form, follow these steps:
Click the Save button on the Quick Access Toolbar.
The Save As dialog box appears.
Your form name appears on the Navigation pane.
When you want to control field selection and the style of form design, use the Form Wizard.
As with all Access wizards, the Form Wizard steps you through the creation process. To use the Form Wizard, follow these steps:
Click the Create tab on the Ribbon.
Several button groups appear on the Ribbon, including the Forms group.
Click the Form Wizard button. (Refer to Figure 8-1.)
The Form Wizard springs into action, as shown in Figure 8-3.
Using the Tables/Queries drop-down menu, select the source of the form’s fields:
The Form Wizard lists the available fields.
Select the fields you want.
Feel free to select fields from different tables, provided the tables are related properly. The wizard will not let you select fields from unrelated tables. For more on relating tables, see Chapter 5, Table Tune Ups.
To remove a field that you accidentally choose, double-click its name in the Selected Fields list. The field jumps back to the Available Fields side of the dialog box.
After you’ve selected all the fields you want to include on your form, click Next.
If you selected fields from more than one table, the Form Wizard takes a moment to ask how you want to organize the data in your form. If you choose to organize your data by the parent table (Chapter 5 shows how), you’ll be asked to show the child table data as either
When the wizard asks about the form layout, choose one of the following layouts and then click Next:
Don’t know which layout is best? Check out the “Giving forms the right look” sidebar.
Enter a descriptive title in the What Title Do You Want for Your Form? box at the top of the Form Wizard screen.
There are good reasons to give your form a descriptive title rather than the default name (which is the name of the data source):
Click Finish to open the form in Form view.
Your new form appears onscreen, as shown in Figure 8-4.
The Form Wizard automatically saves the form as part of the creation process. You don’t need to manually save and name it. All saved forms display in the Forms section of the Navigation pane.
The Access 2016 Form tools and Form Wizard do a great job building forms. In fact, for the typical user, they do just about everything — but they don’t always do it all. So you may need to do some form-tweaking.
If you know some form-design basics, you can clean up most of the problems left behind by the Form tools and Form Wizard.
This section shows how to change the overall look of the form. In particular, you get a handle on moving, sizing, labeling, and formatting controls on your forms. (A control is any design element on a form — say, a line, label, or data-entry box — that affects the appearance of the form. More about that later in the chapter.)
You can make form-design changes in either Design or Layout view.
These instructions concentrate on Layout view because it’s easier to use.
To enter Layout view, follow these steps:
On the Navigation pane, right-click the form you’d like to modify.
The shortcut menu appears.
After building your new form with the Form Wizard or Form tools, you may not like the appearance that the tools have chosen for your form. Fear not! It’s easy to change the look of the form by using the Theme group of buttons. Here’s how:
From the Navigation pane, right-click the form that needs a new look and choose Layout View from the menu that appears.
The form opens in Layout view.
Click the Design tab on the Ribbon.
Several button groups appear on the Ribbon, including the Themes group. (See Figure 8-5.)
Click the Themes button.
An illustrated list (called a Gallery) of themes opens.
Roll the mouse pointer slowly over each theme.
The form in the background changes to match the highlighted theme.
A control is any design element (such as a line, label, or data-entry text box) that appears on a form. The Form Wizard and Form tools do a fine job of constructing forms but often don’t place or size them just right. This section discusses how to take charge of your controls.
The two most common control types display data pulled from an underlying table or query (as with a text box) or supply a design element to keep the data organized on the form (as with a line).
Here are the most common form controls:
Text box: The box where you type your data.
Text boxes are either bound (a way of saying linked) to a table field or unbound (containing a calculation derived from other fields in a table).
Subform: A form inside another form.
Subforms usually display the “many” records of the “one” record when tables are in a one-to-many relationship. (For details on table relationships, see Chapter 5.)
Most controls have a Control Wizard associated with them. Once you create the control, the wizard appears and guides you through the process. Here are the general steps to create a control:
Click the Design tab on the Ribbon if necessary.
The Controls group appears (see Figure 8-6).
From the Controls group, click the appropriate button for the new control (such as combo box) and roll the mouse onto the form.
The mouse pointer changes to a plus sign and icon of the control selected.
Position the mouse at the location on the form where you’d like the new control to appear, then press and drag diagonally to draw the control.
The control wizard appears if applicable.
If you’ve selected a control that has a Control Wizard, follow the steps in the Control Wizard and then click Finish.
The control appears on the form.
To move a control, enter Layout view (as shown previously in this chapter) and then follow these steps:
Put the mouse pointer anywhere on the control that you want to move.
The mouse pointer changes to a four-headed arrow.
Hold down the left mouse button.
The control is selected, so a thick border appears around it. See Figure 8-8 for an example of a selected control.
To select additional controls such as a label corresponding to a text box, press and hold the Ctrl key while clicking the additional control. A thick border will appear around all selected controls.
Drag the control to its new location.
A line follows the mouse pointer as you drag up, down, left, or right.
When the control is in position, release the mouse button.
The control drops smoothly into place.
If you don’t like an adjustment you’ve made, press Ctrl+Z to undo the change and start over from scratch. Access has multiple undo levels, so play to your heart’s content; you can always undo any mistakes.
Sometimes the Form Wizard and Form tools fall a bit short (literally) when they’re sizing your text boxes and labels. A common problem is that the last part of the information displayed in a label or text box is cut off.
To size a control, enter Layout view (as shown previously in this chapter) and then follow these steps:
Put the mouse pointer on the control that you want to size.
The mouse pointer changes to a four-headed arrow. If the controls are anchored, it doesn’t matter which control you roll the mouse pointer over.
Click to select the control.
A thick border appears around the control to indicate that the control is selected.
Move the mouse pointer to the edge of the selected control.
A double-arrow pointer shape appears.
Click and drag to resize the control.
Anchored controls size together horizontally within the same column and vertically within the same row. So when you change the width of one control in a column, all are changed to that same width. When you change the height of one control in a row, all in that row are changed to the same height.
The Form Wizard and Form tools use field names or captions as control labels when they build your forms. If you abbreviated a field name (say, FName for First Name) or caption when creating a table, that abbreviation will become the label for the control created by the Form Wizard and Form tools. So, if a label doesn’t quite say what it should, you’ll need to know how to edit the text in it.
To edit a label, enter Layout view (as shown previously in this chapter) and try this:
Put the mouse pointer anywhere on the label that you want to edit.
The mouse pointer changes to a four-headed arrow.
Click to select the label control.
A thick border indicates that the control is selected.
Click the word you’d like to edit.
A blinking cursor appears on the word.
Click outside of the label control.
The label is deselected and the edit is preserved.
Sometimes an Access form contains an unneeded or unwanted control:
Here’s how you remove the control:
In Layout view, put the mouse pointer anywhere on the control that you want to delete.
The arrow mouse pointer changes to a four-headed arrow.
Click to select the control.
A thick border appears around the control, indicating that it is selected.
Tap the Delete key on your keyboard.
The unwanted control disappears into digital oblivion.
You’re done with form design and ready to take it for a drive. This section explains how to move between records, start a new record, and more.
How do you move between records on the form? The Navigation buttons at the lower left of the form (see Figure 8-9) make it easy to:
Saving is very confusing to those from the Word and Excel world entering the Access world. In most other programs, you enter something new in a document and click Save to save your work. Access is different. The second you move to a new record or close a form, your good friend Access saves the record for you. So, it’s very hard to lose data in Access! Clearing field data and deleting records is not quite so automatic, but that’s a good thing.
To clear the contents of a field, follow these steps:
While in Form view, tab to the field that contains the unwanted data.
The contents of the field are selected.
Tap the Delete key on your keyboard.
The contents of the field are deleted.
Here’s how to delete an entire record:
Click Delete Record in the Records group on the Home tab of the Ribbon.
Access asks you if you want to delete the record and related records if appropriate.
Click Yes in the confirmation dialog box to delete the record.
Adios record!