Access 2007
Creating and Using Forms
Introduction
Another way to populate a database is with the use of forms. An Access 2007 form helps you know exactly what data to enter. This lesson will address the benefits of using forms with a database. It will also show you how to set up a basic form for your Access 2007 database, and will show you how to use the form to populate or edit data in the database. You will also learn how to enhance a basic form with a drop-down list.
Creating and using forms
Watch the video! (Part 1) (3:18min) (Part 2) (6:35min)
Download the example to work along with the video.
Why use forms?
In real life, a form is piece of paper you fill out so someone can collect and keep track of specific information about you. Only one record—your record—is captured with any given paper form.
Access 2007 forms work in very much the same way.
In previous lessons, you saw that you can populate a database by entering records into the tables themselves. If the database has hundreds of records and many fields to populate for any given record, a table can be overwhelming to the person entering data. An Access form lets you enter data one record at a time, without having to see the entire table.
An Access 2007 form also lets you know exactly what information to enter and can even tell you what that information should look like. Adding certain control components to a form—like a drop-down menu—can dramatically increase the integrity of the data that is held in a database.
A database owner wants to control the levels of access other database users have to the data; the fewer the amount of people who are interacting with the data, the lower the chances are of the data becoming compromised. Forms are one more way a database owner can limit the actions of the other users. Form properties can be set so users can only enter records or just view records.
Creating a form
Access 2007 has several automatic tools for creating forms. These tools are located in the Forms group on the Create tab in the Ribbon, as seen below:
The Access 2007 forms tools include:
- The Form command makes a basic form, showing a single record at a time.
- The Split Form command creates a form showing one record on top and includes the Datasheet View of the entire source table on the bottom.
- The Multiple Items command creates a form that shows all records at once, which looks similar to the source table in Datasheet View.
- The Form Wizard is hidden under the More Forms command. It walks you through the process of creating more customized forms.
To create a form using the Form command
The basic Form command is the one we suggest because it allows you to see just one record at a time. It also includes all of the fields in your source table for you, and you can modify the layout of the basic form to hide fields or add controls.
To create a form using this command:
- Begin by highlighting the table you wish to use as a source table.
- With the source table highlighted, select the Form command from the Forms command group in the Create tab on the Ribbon.
- The new form is created and opens in the object pane.
The newly created form has the same name as the source table by default. You can give the form a new name by saving the form. You will be prompted to give the form a name.
Using forms to enter data
Populating a database is easy once you have a basic form in place. Record navigation works the same way for forms as it did for tables. The Navigation Bar is located in the bottom-left of the object pane. The Navigation Buttons work the same way they did for the tables. The following picture shows the navigation buttons for a form.
To add a record using a form
To add a record to the database using a form:
- Navigate to a new record, either by using the New Record navigation button or by using the New command in the Records group on the Ribbon.
- Then, simply add the new data.
- Finally, you must save the record.
Your data must be entered using an acceptable format. The acceptable formats were established when the field properties were set.
Save by using either the Save command on the Ribbon or by progressing to another record using the New (Blank) Record navigation button. Moving to a new record saves the most recently entered record. However, it may be necessary to refresh the table in Datasheet View to see the newest record.
To edit records using a form
Just like in a table, the database user can edit records from a form using the Find and Replace command. This command works exactly the same way for a form as it does in a table.
Creating a drop-down list
Using a drop-down list on a form can increase the integrity of the data in the database because drop-down lists force the form user to select one of the preset options in the list to populate the field. These types of form controls are relatively easy to set up using the Combo Box.
To create a drop-down list using a Combo Box control
- With the form opened in Design View, select the Combo Box command in the Controls group on the Design tab in the Ribbon.
Combo Box Command - Drag and drop the Combo Box sizing tool to create the Combo Box where desired on the form.
Combo Box Sizing Tool - The Combo Box Wizard appears.
Combo Box Wizard - Choose the desired option from the wizard, and click Next.
- Because the middle option was selected in the example above, the wizard progresses to the next step, which asks for the values to be typed into a small table.
Combo Box Wizard
- Next, the wizard asks what to do with the entered values. Access can either remember the values for later use, or it can populate a field with the entered values. Use the drop-down list to select which field Access should use to store the values.
Combo Box Wizard - Once the desired option has been selected, click Next.
- Finally, the wizard gives the Combo Box a generic name, which can be meaningful to you later if there is ever a need to adjust the properties of this or another Combo Box. If you choose, give the Combo Box a name, and click Finish.
Whatever name is entered will appear as a label on the form. This label may be deleted, if desired.
Switch to Form View to see how the Combo Box works. The Category drop-down list appears on our Books form, as seen below.
Challenge!
If you haven't already done so, save the sample Ready2Read database on your own computer.
- Scroll through the customer records using the Customers form.
- Create a basic Books form using the Form command.
- Use the new Books form to enter and save the following data:
- Title: The Secret Streets of Savannah
Author: Amy Little
Category: Travel
Price: $34.99 - Title: Cars and Trucks
Author: Jonathon Bradley
Category: Kids
Price: $14.99
- Title: The Secret Streets of Savannah
- Using the Combo Box command, create a drop-down list on the Books form for the following Categories:
- Fiction
- Nonfiction
- Kids
- History
- Technology
- Home & Garden
- Travel
- Food
- Add another record to the database using the Books form with the drop-down Category selector.
- Use the Find and Replace command to change the price of all books that are $14.99 to be $16.99.