Creating Forms
5
SKILL SUMMARY
Skills Exam Objective Objective Number
Creating Forms Create a form. 4.1.1
Save a form. 4.1.3
Apply a theme. 4.3.4
Sorting and Filtering Data within a Form Sort records by form field. 4.3.3
SOFTWARE ORIENTATION
Forms Group
The Forms group (see Figure 5-1) is located on the Create tab in the Ribbon and can be used to
create a variety of forms.
Creates a new Creates a new form
Creates a simple Creates a new blank blank form in using the Form
form form in Design view Layout view Wizard
Figure 5-1
Forms group on the Create tab
CREATING FORMS
A form is a database object that you can use to enter, edit, or display data from a table or query.
You can use forms to control access to data by limiting which fields or rows of data are displayed
to users. For example, certain users might need to see only certain fields in a table. Providing
those users with a form that contains just those fields makes it easier for them to use the database.
Think of forms as windows through which people see and reach your database in a more visually
attractive and efficient way.
You can create forms in several different ways, depending on how much control you want over the
form’s design. You can quickly create forms that include all fields in a table through a single mouse
click using the Form tool, or you can control the number of fields you’d like to include on the
form as well as the layout of the form using the Form Wizard. You have the most flexibility with
77
78 Lesson 5
the amount and placement of fields on the form when you use Layout or Design view, with Design
view giving you the greatest control over field placement and properties. You can quickly apply a
chosen theme to the form to modify its color and font scheme using the Themes command. Fi-
nally, you can delete any form by simply using the Delete command. In this section, you practice
creating forms using a variety of these skills. You also delete a pre-existing form.
Creating a Simple Form and Deleting a Form
You can use the Form tool to create a form with a single mouse-click. When you use this tool,
all the fields from the underlying data source are placed on the form. Access creates the form and
displays it in Layout view. You can begin using the new form immediately, or you can modify it
in Layout view or Design view to better suit your needs. You can also delete a form to remove it
permanently from the database. In this exercise, you use the Form tool to create a simple form and
use the Delete command to delete a form.
To use the Form tool to create a simple form, first click in the Navigation Pane on the table that
contains the data you want to see on the form. On the Create tab, in the Forms group, click Form.
To save a form design, click the File tab and then click Save. Type a name in the Form Name box
and then click OK. After you save your form design, you can run the form as often as you want.
The design stays the same, but you see current data every time you view the form. If your needs
change, you can modify the form design or create a new form that is based on the original. You
can also permanently delete the form or any preexisting forms from the database by using the
Delete command in the Records group of the Home tab. You can delete a form if you erroneously
created it or simply want to unclutter the database.
STEP BY STEP Create a Simple Form and Delete a Form
GET READY. Before you begin these steps, make sure that your computer is on. Sign on, if
necessary, and start Access.
1. OPEN the Graphic Art database from the data files for this lesson and then SAVE the
database as Graphic Art-final.
2. In the Navigation Pane, click the Photo Exhibit table. This is the table for which you will
create a form.
3. On the Create tab, in the Forms group, click the Form button. Access creates the form
and displays it in Layout view (see Figure 5-2). Your form may be slightly different.
Figure 5-2
Simple form
4. Click the File tab and then click Save. The Save As dialog box appears.
Creating Forms 79
Take Note You can use the record navigation buttons at the bottom of a form to navigate among the form’s
records, just as you used them to navigate among records in a table in Lesson 3.
5. Click OK to accept the Photo Exhibit form name suggested by Access. The form name
appears in the Navigation Pane.
6. Click the Close button on the Photo Exhibit form to close it.
7. In the Navigation Pane, click the Photo Info form. This is a form that you no longer
need.
8. In the Records group, click the Delete button arrow and then click the Delete command
on the menu that appears.
9. Click Yes on the dialog box asking you if you want to permanently delete the Photo Info
form. The form is now permanently deleted from the database.
Troubleshooting In step 7, don’t double click the form. If you do, the form opens and you can’t delete the form
when it is open.
PAUSE. LEAVE the database open to use in the next exercise.
Creating a Form in Design View
When you click the Form Design button, a new blank form is created in Design view. Design
view gives you a more detailed view of the structure of your form than Layout view. The form is
not actually running when it is shown in Design view, so you cannot see the underlying data while
you are making design changes. In this exercise, you create a new blank form in Design view and
manually add fields to it.
You can fine-tune your form’s design by working in Design view. To change to Design view, right-
click the form name in the Navigation Pane and then click Design view. You can also use the View
button on the Home tab of the Ribbon. You can add new controls—used to enter, edit, and find
information—and fields to the form by adding them to the design grid. Plus, the property sheet
gives you access to a large number of properties that you can set to customize your form.
STEP BY STEP Create a Form in Design View
GET READY. USE the Graphic Art-final database that is open from the previous exercise.
1. On the Create tab, in the Forms group, click the Form Design button. A new blank form
is created in Design view (see Figure 5-3).
Figure 5-3
New blank form in Design view
80 Lesson 5
2. On the Form Design Tools Design contextual tab, in the Tools group, click the Add
Existing Fields button. The Field List pane appears.
3. Click the Show all tables link, and then the expand button to the left of the table name.
The available fields display from the Photo Exhibit table (see Figure 5-4).
Expand button expanded Table name
Figure 5-4
Field List pane with expand
button and available fields
Available
fields
4. In the list of fields, double-click Artist to add it to the form.
5. Double-click Image Title to add it to the form.
6. Double-click Price to add it to the form. Your form should look similar to Figure 5-5.
Figure 5-5
Fields inserted in Design view
7. Click the File tab and then click Save.
8. In the Save As dialog box, type Photo Label and then click OK.
9. On the Design menu, in the Views group, click the lower half of the View button and
then click Form View to display the form in Form view (see Figure 5-6).
Creating Forms 81
Figure 5-6
Form view
10. Click the Close button on Photo Label to close the form.
PAUSE. LEAVE the database open to use in the next exercise.
Creating a Form in Layout View
If other form-building tools do not fit your needs, you can use the Blank Form tool to create a
form. The Blank Form tool creates a new form in Layout view. This can be a very quick way to
build a form, especially if you plan to put only a few fields on your form. Click the Blank Form
button to quickly create a new blank form in Layout view. This allows you to make design changes
to the form while viewing the underlying data. In this exercise, you use the Blank Form tool to
create a form in Layout view.
On the Create tab, in the Forms group, click the Blank Form button. Access opens a blank form
in Layout view and displays the Field List pane. To add a field to the form, double-click it or drag
it onto the form. In Layout view, you can make design changes to the form while it is displaying
data.
STEP BY STEP Create a Form in Layout View
GET READY. USE the Graphic Art-final database that is open from the previous exercise.
1. On the Create tab, in the Forms group, click the Blank Form button. A new blank form is
created in Layout view.
2. Click the Show all tables link in the Field List pane to show the Photo Exhibit table
name, if necessary.
3. If necessary, click the expand button next to the Photo Exhibit table name to show a list
of fields related to the table, and then double-click Image Title to add it to the form.
4. Double-click Dimensions to add it to the form.
5. Double-click Media to add it to the form. Your form should look similar to Figure 5-7.
6. Click the File tab and then click Save.
7. In the Save As dialog box, type Image Info and then click OK.
8. Click the Close button to close the Field List.
9. Click the Close button on Image Info to close the form.
PAUSE. LEAVE the database open to use in the next exercise.
Take Note To add more than one field at a time after adding at least one other field, press Ctrl and click sev-
eral fields, and then drag them all onto the form at once.
82 Lesson 5
Figure 5-7
Fields inserted in Layout view
Using the Form Wizard
Another method of building a form is to use the Form Wizard tool. The Form Wizard allows
you to select the fields that will appear on the form, choose the form layout (which determines the
positioning of controls, objects, and data on a form), and also choose a predefined style, if desired.
In this exercise, you use the Form Wizard to create a datasheet form. A datasheet form looks very
similar to the table upon which it is based and provides a way to enter data using columns and
rows.
STEP BY STEP Use the Form Wizard
GET READY. USE the Graphic Art-final database that is open from the previous exercise.
1. On the Create tab, in the Forms group, click the Form Wizard button. The Form Wizard
appears (see Figure 5-8).
Figure 5-8
Form Wizard
Move selected field
Move all fields
Creating Forms 83
2. Click the >> button to move all the fields from the Available Fields box to the Selected
Fields box.
3. Click the Next button to move to the next page in the Form Wizard
4. Click Datasheet as the layout for the form. Form layouts help determine the positioning
of controls, objects, and data on a form.
5. Click the Next button to move to the final page in the Form Wizard.
6. Type Photo Details as the title of the form.
7. Click the Finish button. A datasheet form appears (see Figure 5-9).
Figure 5-9
Datasheet form
8. Click the Close button on Photo Details to close the form.
PAUSE. LEAVE the database open to use in the next exercise.
Take Note To include fields from more than one table on your form, do not click Next or Finish after you
select the fields from the first table on the first page of the Form Wizard. Instead, repeat the steps
to select another table and then click any additional fields that you want to include on the form
before continuing.
Applying a Theme
The Themes command applies a predefined color and font scheme to a form or report. A theme
modifies a form by controlling the color and fonts of its text. In this exercise, you apply a Theme
to a form.
To apply a theme, first change to Layout view. On the Form Layout Tools Design contextual tab,
in the Themes group, click the Themes button to view a gallery of theme styles from which to
choose. You can point to each option to see the name of that format and a live preview before it is
applied to the form.
84 Lesson 5
STEP BY STEP Apply a Theme
GET READY. USE the Graphic Art-final database that is open from the previous exercise.
1. Double-click the Image Info form in the Navigation Pane to open it.
2. On the Home tab, in the Views group, click the lower half of the View button and then
click Layout View on the View menu.
3. On the Form Layout Tools Design contextual tab, in the Themes group, click the
Themes button. A gallery of themes appears (see Figure 5-10).
Figure 5-10
Themes gallery
4. Click the Integral theme (fourth item in the first row) to apply it to the form. Notice how
the form’s text has changed (see Figure 5-11).
Figure 5-11
Form in Layout view with
Integral theme applied
5. Click the Close button on Image Info to close the form.
PAUSE. LEAVE the database open to use in the next exercise.
Creating Forms 85
SORTING AND FILTERING DATA WITHIN A FORM
Sorting data in a form can help make it much more effective and easy to use. Sorting helps users
review and locate the records they want without having to browse the data. To find one or more
specific records in a form, you can use a filter. A filter limits a view of data to specific records
without requiring you to alter the design of the form. You also can use a tool called filter by form
to filter on several fields in a form or to find a specific record.
Sorting Data within a Form
You can sort data in the Form view of a form. The order that is chosen when a form is designed
becomes that object’s default sort order. But when viewing the form, users can sort the records in
whatever way is most useful for them. You can sort the records in a form on one or more fields. In
this exercise, you sort data in a form in ascending order.
STEP BY STEP Sort Data within a Form
GET READY. USE the Graphic Art-final database that is open from the previous exercise.
1. Double-click the Photo Label form in the Navigation Pane to open it in Form view.
2. Right-click the Price field to display the shortcut menu.
3. Click Sort Smallest to Largest. The form is sorted by price from smallest to largest.
The record with the smallest price is displayed first.
4. Click the Next record button on the record navigator at the bottom of the form.
Continue clicking through all the records to see the records in order according to price.
5. On the Home tab, in the Sort & Filter group, click the Remove Sort button. The records
have resorted back to their original order.
6. Click the Close button on Photo Label to close the form.
PAUSE. LEAVE the database open to use in the next exercise.
Take Note You cannot sort on a field that contains attachments. Also, when sorting on a field with the Yes/No
data type, a value of “Yes” is considered “Selected,” and when sorted in ascending order, appears
at the top of the list. A value of “No” is considered “Cleared,” and when sorted in ascending order,
appears at the bottom of the list.
You must identify the fields on which you want to sort. To sort on two or more fields, identify the
fields that will act as the innermost and outermost sort fields. Right-click anywhere in the column
corresponding to the innermost field and then click one of the sort commands. The commands
vary based on the type of data that is in the selected field. Repeat the process for each sort field,
ending with the outermost sort field. The records are rearranged to match the sort order.
The last-applied sort order is automatically saved with the form. If you want it automatically
applied the next time you open the form, set the Order By On Load property of the form to Yes.
Remember that you cannot remove a sort order from just a single field. To remove sorting from all
sort fields, click Remove Sort on the Home tab in the Sort & Filter group.
Filtering Data within a Form
Common filters are built into every view that displays data. The filters available depend on the
type and values of the field. When you apply the filter, only records that contain the values that
you are interested in are included in the view. The rest are hidden until you remove the filter. In
this exercise, you filter form data using common filters.
Filters are easy to apply and remove. Filter settings remain in effect until you close the form—even
if you change to another view. If you save the form while the filter is applied, it will be available
86 Lesson 5
the next time you open the form. To permanently remove a filter, on the Home tab, in the Sort &
Filter group, click the Advanced button and then click Clear All Filters.
STEP BY STEP Filter Data with Common Filters
GET READY. USE the Graphic Art-final database that is open from the previous exercise.
1. Double-click the Photo Exhibit form in the Navigation Pane to open it in Form view.
2. Right-click the Media field to display the shortcut menu, click Text Filters, and then
select Contains, as shown in Figure 5-12. Click Contains to display the Custom Filter
dialog box.
Figure 5-12
Media field text filters
3. In the Media contains box, type print and then click OK.
4. Click the Next record button on the record navigator at the bottom of the form.
Continue clicking to see the five records that contain the word “print” in the Media
field.
5. Right-click the Price field to display the shortcut menu and then click Number Filters.
6. Click Less Than to display the Custom Filter dialog box.
7. In the Price is less than or equal to box, type 500 and then click OK.
8. Click the Next record button on the record navigator at the bottom of the form.
Continue clicking to see the three photos that use print media and are less than $500.
9. On the Home tab, in the Sort & Filter group, click the Advanced Filter Options button
and then click Clear All Filters.
PAUSE. LEAVE the database open to use in the next exercise.
Using Filter by Form
Although only a single filter can be in effect for any one field at any one time, you can specify a dif-
ferent filter for each field that is present in the view. In addition to the ready-to-use filters for each
data type, you can also filter a form by completing an action called filter by form. Filter by form
is useful when you want to filter several fields in a form or if you are trying to find a specific record.
Access creates a blank form that is similar to the original form; you then complete as many of the
Creating Forms 87
fields as you want. When you are finished, Access finds the records that contain the specified val-
ues. In this exercise, you filter by form.
To use filter by form, open the form in Form view and make sure the view is not already filtered
by verifying that either the Unfiltered icon or the dimmed No Filter icon is present on the record
selector bar. On the Home tab, in the Sort & Filter group, click Advanced and then click Filter By
Form. Click the down arrow in a field to display the available values.
Enter the first set of values on the Look for tab at the bottom of the page and then click the Or tab
and enter the next set of values. Each time you click the Or tab, Access creates another Or tab; so
you can continue to add additional filter values. Click the Toggle Filter button to apply the filter.
The filter returns any record that contains all of the values specified on the Look for tab, or all of the
values specified on the first Or tab, or all of the values specified on the second Or tab, and so on.
STEP BY STEP Use Filter by Form
GET READY. USE the Graphic Art-final database that is open from the previous exercise.
1. On the Home tab, in the Sort & Filter group, click the Advanced Filter Options button
and then click Filter By Form. A form filter appears.
2. Place the insertion point in the Dimensions box and then click the down arrow on the
right to display the list of options shown in Figure 5-13.
Figure 5-13
Form filter field options
3. Click 30 X 40.
4. Click the Or tab at the bottom of the form.
5. Place the insertion point in the Dimensions box, click the down arrow and then click 12
X 28.
6. On the Home tab, in the Sort & Filter group, click the Toggle Filter button to apply the
filter. The records containing either the dimensions 30 X 40 or 12 X 28 are displayed
(see Figure 5-14).
88 Lesson 5
Figure 5-14
Form filter results
7. Click the Next record button on the record navigator at the bottom of the form to see
the second record in the form filter results.
8. On the Home tab, in the Sort & Filter group, click the Toggle Filter button again to
remove the filter, click the Advanced button and then click Clear All Filters.
9. Click the File tab and then click Close.
STOP. CLOSE the database and then EXIT Access.
Take Note If you want a field value to operate as a filter that is independent of other field values, you must
enter that value on the Look for tab and each Or tab. In other words, the Look for tab and each
Or tab represents an alternate set of filter values.
Creating Forms 89
Knowledge Assessment
Matching
Match the term in Column 1 to its description in Column 2.
Column 1 Column 2
1. Form Design button a. Useful when you want to filter on several fields in a form
or if you are trying to find a specific record
2. Blank Form button b. Creates a simple form with a single mouse-click
3. Filter by form c. Quickly creates a new blank form in Layout view
4. Form tool d. Quickly creates a new blank form in Design view
5. Common filters e. Built into every view that displays data
True/False
Circle T if the statement is true or F if the statement is false.
T F 1. Forms can be used to control access to data, such as which fields or rows of
data are displayed.
T F 2. To access the Theme options, first change to Form view.
T F 3. You cannot remove a sort order from just a single field.
T F 4. The filters available depend on the field’s data type and values.
T F 5. When using the Form Wizard, you can only include fields from one table.
Projects
Project 5-1: Creating, Sorting, and Filtering Forms
In this project, you are the manager at Southridge Video. To expand the store, you have recently
started taking used games in trade. You store information about each title in an Access database.
You decide to create some forms to help you use the database more efficiently. Next, when a cus-
tomer comes in and asks about game publishers and the availability of a particular game, you sort
and filter data in the forms you created to get the information that you need.
GET READY. LAUNCH Access if it is not already running.
1. OPEN Games inventory from the data files for this lesson and then SAVE the database
as Games inventory-final.
2. In the Navigation Pane, double-click Games: Table to open the table.
3. On the Create tab, in the Forms group, click the Form button to create a simple form
and display it in Layout view.
4. Click the File tab and then click Save.
5. In the Save As dialog box, click OK to accept the Games form name suggested by
Access.
6. Click the Close button for Games to close the form.
7. On the Create tab, in the Forms group, click the Form Design button to create a new
blank form in Design view.
8. On the Form Design Tools Design contextual tab, in the Tools group, click the Add
Existing Fields button to display the Field List pane.
9. Click the Show all tables link in the Field List pane, if necessary.
10. Click the expand button next to Games to list the available fields, if necessary.
90 Lesson 5
11. Double-click Title to add it to the form.
12. Double-click Rating to add it to the form.
13. Double-click Platform to add it to the form.
14. Click the File tab and then click Save.
15. In the Save As dialog box, type Game Rating and then click OK.
16. Click the Close button to close the Field List.
17. On the Design contextual tab, in the Views group, click the lower half of the View
button and then click Form View to display the form in Form view.
18. Click the Close button for Game Rating to close the form.
19. In the Navigation Pane, double-click the Games form to open it.
20. Right-click the Publisher field to display the shortcut menu.
21. Click Sort A to Z to sort the form by publisher name in alphabetic order.
22. Navigate to record 3, titled Marvel: Ultimate Alliance.
23. Right-click the Title field and then click Contains “Marvel: Ultimate Alliance”.
24. Click the Next record button on the record navigator at the bottom of the form to see
all the versions of the game with that name.
25. On the Home tab, in the Sort & Filter group, click the Remove Sort button, click the
Advanced down arrow and then click Clear All Filters.
26. CLOSE the database.
PAUSE. LEAVE Access open for the next project.
Project 5-2: Applying a Theme
In this project, your brother owns Wingtip Toys and recently started keeping a list of the store
inventory in an Access database. He wants to add a form to the database and asks for your help.
Add a simple form with a theme, and then show him how to sort and apply filters.
GET READY. LAUNCH Access if it is not already running.
1. OPEN Toy inventory from the data files for this lesson and then SAVE the database as
Toy inventory-final.
2. In the Navigation Pane, double-click Inventory: Table to open the table.
3. Use the Form tool to create a simple form.
4. Format the form using the Organic theme option.
5. SAVE the form as Inventory.
6. Sort the form’s In Stock field from Largest to Smallest.
7. Sort the Description field from A to Z.
8. Run a filter that finds all the records where the Price field is between $50 and $100.
9. Clear all sorts and filters.
10. Create a filter by form to find all the records that have two items in stock.
CLOSE the form, CLOSE the database, and then EXIT Access.