Chapter 10. Simplifying Data Entry by Using Forms

Chapter at a Glance

Simplifying Data Entry by Using Forms

In this chapter, you will learn to:

Create a form by using the Form tool.

Refine form properties.

Change the arrangement of a form.

Add controls to a form.

Enter data in a form by using VBA.

Create a form by using an AutoForm.

Add a subform to a form.

A database that contains the day-to-day records of an active company is useful only if it is kept current and if the information stored in it can be found quickly. Although Microsoft Office Access 2007 is fairly easy to use, entering, editing, and retrieving information in Datasheet view is not a task you would want to assign to someone who’s not familiar with Access. Not only would these tasks be tedious and inefficient, but working in Datasheet view leaves far too much room for error, especially if details of complex transactions have to be entered into several related tables. The solution to this problem, and the first step in the conversion of this database to a database application in which you can efficiently manage information, is to create and use forms.

A form is an organized and formatted view of some or all of the fields from one or more tables or queries. Forms work interactively with the tables in a database. You use controls in the form to enter new information, to edit or remove existing information, or to locate information. Like printed forms, Access forms can include label controls that tell users what type of information they are expected to enter, as well as text box controls in which they can view or enter information. Unlike printed forms, Access forms can also include a variety of other controls, such as option buttons and command buttons that transform Access forms into something very much like a Microsoft Windows dialog box or wizard page.

Tip

You can also create forms to navigate among the features and functions of a database application and have little or no connection with its actual data. A switchboard is an example of this type of form.

As with other Access objects, you can create forms manually or with the help of a wizard. It is best to create navigational and housekeeping forms, such as switchboards, manually in Design view. However, you should always create forms that are based on tables by using a wizard, and then refine the form manually—not because it is difficult to drag the necessary controls onto a form, but because there is simply no point in doing it manually.

In this chapter, you will discover how easy it is to create forms—either by using the Form tool or by using the Form wizard—that you can modify to suit your needs, and how to present information from multiple tables in one form by using subforms. You will control a form’s function and appearance by inserting controls and modifying the form and control properties. Then you will learn how to automatically enter data in a form by using Microsoft Visual Basic for Applications (VBA) when a user performs an action in the control, such as clicking or entering text.

See Also

Do you need only a quick refresher on the topics in this chapter? See the Quick Reference entries at the beginning of this book.

Important

Important

Before you can use the practice files in this chapter, you need to install them from the book’s companion CD to their default location. See "Using the Book’s CD" at the beginning of this book for more information.

Troubleshooting

Graphics and operating system–related instructions in this book reflect the Windows Vista user interface. If your computer is running Microsoft Windows XP and you experience trouble following the instructions as written, please refer to the "Information for Readers Running Windows XP" section at the beginning of this book.

Creating a Form by Using the Form Tool

Before you begin creating a form, you need to know which database query or table to base it on, and have an idea of how the form will be used. After making these decisions, you can create a form in many ways. Remember that like almost any other object in Access, after you create the form, you can customize it in Design view if it does not quite meet your needs.

The quickest way is to select a table or query in the Navigation Pane, and then click the Form button in the Forms group on the Create tab. This creates a simple form using all the fields in the table or query, and opens it in Layout view.

If there is one (and only one) other table in the database that has a one-to-many relationship with the table on which your form is based, then the Form tool adds a datasheet (called a subform) which displays all the records in the related table that pertain to the current record in the main form.

In this exercise, you will use the Form tool to create a form based on a table.

Note

USE the 01_CreateFormTool database. This practice file is located in the Chapter10 subfolder under SBS_Office2007.

BE SURE TO start Access before beginning this exercise.

OPEN the 01_CreateFormTool database.

  1. In the Navigation Pane, under Tables, double-click Customers.

    The Customers table opens in Datasheet view.

    Creating a Form by Using the Form Tool
  2. On the Create tab, in the Forms group, click the Form button

    Creating a Form by Using the Form Tool

    Access creates and displays a simple form based on the active table.

    Tip

    You don’t have to open a table to create a form based on it. You can simply click the table in the Navigation Pane to select it, then click the Form button on the Create tab in the Forms group. But it is sometimes useful to have the table open behind the form in order to verify the form contents against the table contents.

    Tip

    The Form tool automatically added a title (Customer) and a placeholder for a logo in the form header.

  3. Scroll through a few of the records by using the navigation controls at the bottom of the form.

    You can compare the information shown in the form to that in the datasheet view of the table by alternately clicking the Customers table tab and the Customers form tab in the database window to easily switch back and forth between views.

Note

CLOSE the Customers form (without saving your changes) and the 01_CreateFormTool database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.62.6