Chapter :Lesson 4: Creating and Modifying Forms:Creating a Form

Contents

Chapter :Lesson 4: Creating and Modifying Forms:Creating a Form

Creating a Form

Creating a Form with the Form Tool

Creating a Form with the Split Form Tool

Creating a Form with the Multiple Items and Datasheet Tools

Step-by-Step 4.1

Creating a Form with the Form Wizard

Step-by-Step 4.2

Chapter :Lesson 4: Creating and Modifying Forms:Navigating a Form

Navigating a Form

Step-by-Step 4.3

Chapter :Lesson 4: Creating and Modifying Forms:Using a Form to Find and Replace Data

Using a Form to Find and Replace Data

Step-by-Step 4.4

Chapter :Lesson 4: Creating and Modifying Forms:Using a Form to Update Data

Using a Form to Update Data

Step-by-Step 4.5

Chapter :Lesson 4: Creating and Modifying Forms:Using a Form to Delete Data

Using a Form to Delete Data

Step-by-Step 4.6

Chapter :Lesson 4: Creating and Modifying Forms:Creating and Modifying a Form in Layout View

Creating and Modifying a Form in Layout View

Step-by-Step 4.7

Adding a Title to a Form and Changing its Format

EXTRA FOR EXPERTS

Step-by-Step 4.8

Resizing a Control in a Form

Step-by-Step 4.9

Moving a Control in a Form

Step-by-Step 4.10

Chapter :Lesson 4: Creating and Modifying Forms:Adding an Unbound Control to a Form in Design View

Adding an Unbound Control to a Form in Design View

EXTRA FOR EXPERTS

Step-by-Step 4.11

Chapter :Lesson 4: Creating and Modifying Forms:Previewing and Printing a Form

Previewing and Printing a Form

Step-by-Step 4.12

Chapter :Lesson 4: Creating and Modifying Forms:End of Chapter Review

End of Chapter Review

Lesson 4: Creating and Modifying Forms: Summary

Lesson 4: Creating and Modifying Forms: Vocabulary Review

Lesson 4: Creating and Modifying Forms: Review Questions

TRUE / FALSE

WRITTEN QUESTIONS

FILL IN THE BLANK

Lesson 4: Creating and Modifying Forms: Projects

PROJECT 4–1

PROJECT 4–2

PROJECT 4–3

Lesson 4: Creating and Modifying Forms: Critical Thinking

ACTIVITY 4–1

ACTIVITY 4–2

Creating a Form

A form is a database object that displays data from one or more tables or queries in a format that has a similar appearance to a paper form. The tables or queries that provide the data to be displayed in a form are called the record source. Most database experts agree that users should make all database updates using a form, instead of using table datasheets, because forms provide more control over the way data is displayed, updated, and entered. In addition, most users find that working in a form is easier than working in a table datasheet. The form can contain messages about how to enter data, format data in different ways to call attention to it, and include features that prevent users from updating data that should not be changed.

Creating a Form

Creating a Form with the Form Tool

Access includes tools that you can use to create different kinds of forms. After selecting the table or query in the Navigation Pane on which to base the form, click the Create tab on the Ribbon. The different options for creating forms are located in the Forms group on the Create tab. Click the Form button to use the Form tool, which creates a simple form that includes all the fields in the selected table or query, uses a simple format, and includes a title with the same name as the table or query on which it is based. Figure 4–1 shows a form created using the Form tool. Each field in the record source appears in the form. In Figure 4–1, the “Listing ID” text appears in a label, and the field value for the first record (2042) appears in a text box. When fields appear in a form, they appear in controls. In this form, the Listing ID label and the Listing ID text box are controls. You can click the buttons on the record navigation bar at the bottom of the Form window to navigate the records in the record source and display them in the form.

FIGURE 4–1 Form created by the Form tool

When you use a tool to create a form, the form opens in Layout view. In Layout view, you can view the controls in the form and data from the record source at the same time. You can also make certain changes to the form's format and appearance, such as resizing a control. When you click a control in Layout view, an orange border appears around the control to indicate that it is selected.

Creating a Form with the Split Form Tool

The Split Form tool creates a form using all the fields in the selected table or query and splits the window into two panes, as shown in Figure 4–2. To create a split form, click the More Forms button in the Forms group on the Create tab, and then click Split Form. In the top pane, you see a form that is similar to the one created by the Form tool. In the bottom pane, you see a datasheet that contains the form data. The two views are synchronized—when you select a field in the top pane, it is also selected in the bottom pane.

FIGURE 4–2 Form created by the Split Form tool

Creating a Form with the Multiple Items and Datasheet Tools

The Multiple Items tool creates a form that lists all the fields in a datasheet format, but using a style that is similar to the form created by the Form tool. The Datasheet tool creates a form that looks just like a datasheet. All of these tools create forms quickly and easily. To use the Multiple Items tool or the Datasheet tool, click the More Forms button in the Forms group on the Create tab, and then click Multiple Items or Datasheet in the list.

Step-by-Step 4.1

1. Open the Broker.accdb database from the Access Lesson 04 folder where your Data Files are stored.

2. If the Security Warning opens, click the Enable Content button.

3. In the Navigation Pane, click the Listings table to select it.

4. On the Ribbon, click the Create tab. In the Forms group, click the Form button. The Form tool creates a form using all the fields in the Listings table and displays the first record in the Listings table. See Figure 4–1.

5. On the Ribbon, click the Create tab. In the Forms group, click the More Forms button, and then click Split Form. Access creates a split form based on the Listings table, as shown in Figure 4–2.

6. On the Ribbon, click the Create tab. In the Forms group, click the More Forms button, and then click Multiple Items. Access creates a multiple items form, which displays the data from the Listings table in a form with a format similar to a datasheet.

7. On the Ribbon, click the Create tab. In the Forms group, click the More Forms button, and then click Datasheet. Access creates a form based on the Listings table that looks like a table or query datasheet.

8. Click the Close button

to close each form that you created. Save each form using the form name that Access suggests. Leave the database open for the next Step-by-Step.

EXTRA FOR EXPERTS

Table, form, and report objects in the database can have the same name. For example, the Broker database can contain a Listings table and a Listings form. However, you cannot give the same name to a table and a query object in the same database.

Creating a Form with the Form Wizard

When you need to create a simple form quickly, you can use the Form Wizard, which helps you create a form by letting you select options in dialog boxes to specify the form's record source and layout. To start the Form Wizard, click the Create tab, and then click the Form Wizard button in the Forms group. The Form Wizard provides four form layouts from which to choose. The Columnar layout displays fields in a stacked column format, with labels to the left of their controls. The Tabular layout displays fields with the labels at the top of a column that contains the field values. The Datasheet layout displays fields in a datasheet format. The Justified layout displays fields across the screen in the order in which they occur. A form's style, also called a theme, formats the form and its controls using a predefined color, font, and design scheme. After creating a form with any Form tool, you can use the tools and features in Access to customize the form.

Step-by-Step 4.2

1. On the Ribbon, click the Create tab. In the Forms group, click the Form Wizard button. The first dialog box of the Form Wizard opens.

2. Click the Tables/Queries arrow, and then click Table: Brokers in the list. The fields in the Brokers table appear in the Available Fields list box.

3. Click the Select All button

to move all fields to the Selected Fields list box, as shown in Figure 4–3.

FIGURE 4–3 Form Wizard dialog box after selecting the table and fields to include

4. Click Next. The second Form Wizard dialog box opens.

5. Make sure that the Columnar option button is selected, and then click Next. In the final dialog box, you enter a title for the form or accept the default name. You'll accept the default name, Brokers.

6. Click Finish. The Brokers form appears in Form view, as shown in Figure 4–4. The default Office theme is applied to the form. The theme formats the form's colors and fonts. Leave the form open for the next Step-by-Step.

TIP

The default form name is the name of the table or query object on which the form is based.

FIGURE 4–4 Brokers form in Form view

Chapter :Lesson 4: Creating and Modifying Forms:Navigating a Form

Navigating a Form

When you create a form using the Form Wizard, the form opens in Form view. When a form is displayed in Form view, you will see each record in the record source, one at a time, in the form. Form view includes a record navigation bar at the bottom of the Form view window that you can use to navigate the records. This record navigation bar has the same buttons with the same functions as the record navigation bar you used to navigate records in a table or query datasheet.

Step-by-Step 4.3

1. On the record navigation bar, click the Last record button

. The last record in the Brokers table, record 9, appears in the form.

2. On the record navigation bar, click the Previous record button

. Record 8 is displayed in the form.

3. On the record navigation bar, click in the Current Record text box, select the 8 in the text box, type 2, and then press Enter. The second record is displayed in the form.

4. On the record navigation bar, click the First record button

. The first record is displayed in the form. Leave the Brokers form open for the next Step-by-Step.

Chapter :Lesson 4: Creating and Modifying Forms:Using a Form to Find and Replace Data

Using a Form to Find and Replace Data

You have used filters and queries to find data in a database. Another option for finding data in a database quickly is to use the Find command, which is available when you are using a table or query datasheet, form, or report. When you click the Find button in the Find group on the Home tab, the Find and Replace dialog box shown in Figure 4–5 opens.

FIGURE 4–5 Find and Replace dialog box

You have several options for finding data, including finding and replacing data. If you select part of a field value in the form (one or more characters or a single word) before clicking the Find button, the selected text appears in the Find What list box automatically. If nothing is selected or more than one word is selected before clicking the Find button, the Find What list box is empty, in which case you type the value you want to find in the list box.

When a field is selected in the form, “Current field” appears in the Look In list box when you open the Find and Replace dialog box. If you want to search the entire table for a matching field value, click the Look In arrow, and then click “Current document.” You can use the options in the Match menu to search any part of the field, the whole field, or the start of the field as follows:

  • If you type S in the Find What list box, and then select the Any Part of Field option in the Match menu, you'll find values that contain the letter S anywhere in the value.
  • If you select the Whole Field option, you'll find values that contain only the letter S.
  • If you select the Start of Field option, you'll find values that begin with the letter S.

The Search option lets you search the entire form, or up and down from the location of the insertion point. The two check boxes—Match Case and Search Fields As Formatted—let you search for a matching value that has the same case as the entry in the Find What list box and search for formatted values, respectively. When the Match Case check box is selected, typing Stars in the Find What list box will find a record that contains the word Stars but will not select a record that contains the word stars. To start searching the form for matching records, click Find Next.

If you click the Replace tab in the Find and Replace dialog box, you will see additional options for finding text and replacing it with different text. The only difference is that you type the value that you want to find in the Find What list box and type the value that you want to replace it with in the Replace With list box. Figure 4–6 shows the Replace tab. Notice the Replace and Replace All buttons. When you start searching the form for matching values by clicking Find Next, you'll find the first matching value. Clicking Replace replaces that instance and resumes searching for the Find What value; clicking Replace All replaces that instance and all others that match.

FIGURE 4–6 Replace tab in the Find and Replace dialog box

Step-by-Step 4.4

1. Double-click the word McCormack in the Affiliation field in the first record to select it.

2. In the Find group on the Home tab, click the Find button. The Find and Replace dialog box opens. Notice that the selected field value McCormack in the Affiliation field appears in the Find What list box. See Figure 4–7.

FIGURE 4–7 Find and Replace dialog box with selected Find What value

TIP

If necessary, drag the Find and Replace dialog box to below the Cell Phone field in the form so you can see all the fields in the form.

3. Make sure that the options in your dialog box match the ones shown in Figure 4–7. Click Find Next. Because the Match option is set to Whole Field, and there is no field value in the Affiliation field that contains only the word McCormack, Access opens a dialog box indicating that it found no matching items.

4. Click OK to close the dialog box.

5. Click the Match arrow in the Find and Replace dialog box, and then click Any Part of Field. Click Find Next. The Find command locates the word McCormack in the fourth record and selects it.

6. Click Find Next. The Find command locates a match in the first record. It displays the first record and selects the word McCormack in the record.

7. In the Find and Replace dialog box, click the Replace tab.

8. In the Replace With list box, type Greene.

9. Click the Look In arrow, click Current document, and then make sure the Match value is Any Part of Field. Click Replace. The word McCormack in the first record is replaced with the word Greene. The next record containing the Find What value is selected (record 4).

10. Click Replace. The word McCormack is replaced with the word Greene in the fourth record. Click Replace. Because record 4 contains the last occurrence of the word McCormack in the Affiliation field, a dialog box opens and indicates that Access cannot find any more matches.

EXTRA FOR EXPERTS