Objective 2. Use a Form to Add and Delete Records

Adding and deleting records using a form helps to prevent data entry errors, because the person performing the data entry is looking at only one record at a time. Recall that your database is useful only if the information is accuratejust like your personal address book is useful only if it contains accurate addresses and phone numbers.


[Page 1054]

Activity 3.2. Adding Records to a Table Using a Form

Forms are based on, bound to, a table where the records are stored. That is, when a record is entered in a form, the new record is added to the corresponding table. The reverse is also truewhen a record is added to a table, the new record can be viewed in the corresponding form. In this activity, you will add a new record to the Club Members table using the AutoForm that you just created.

1.

In the navigation area of the new form, click the New Record button .

The form is cleared so a new record can be entered. This will increase the number of records in the table to 13.

2.

In the Student# field, type 22202 and then press .

Use the key to move from field to field in a form. This is known as the tab orderthe order in which the insertion point moves from one field to the next on a form when you press the key. After you start typing, the pencil image displays in the gray bar to the left.

3.

Continue entering the data as shown below using your own name and then compare your screen with Figure 3.3.

Figure 3.3.


Student#

First Name

Last Name

Phone

Email Address

22202

Firstname

Lastname

(312) 555-0022

Lastname@Imcc.edu


Alert!: Does a Blank Form Display?

If you press or after typing the Email Address, the record you entered is saved and a new blank form displays. If this happens, click the Previous Record button to view the record you just entered.



[Page 1055]

Activity 3.3. Deleting Records from a Table Using a Form

You can delete records from a database table using a form. In this activity, you will delete a record in the Club Members tablethe record for Alphonse Moore.

1.

With the Club Members form open, click in the Last Name field, and then on the Form View toolbar, click the Find button . Alternatively, press to open the Find and Replace dialog box.

2.

Notice that the Look In box indicates the Last Name field, then in the Find What box, type Moore Click Find Next and then compare your screen with Figure 3.4 to confirm that the record for Alphonse Moore displays.

Figure 3.4.


3.

Close the Find and Replace dialog box. In the form, click anywhere in the bar to the left of the record.

The bar is selected; this area is the record selector. When the record selector is highlighted in blackselectedall the fields in the displayed record are selected. The record selector in the form is similar to the record selector in a table. The record selector selects an entire record in a form, just as the record selector in a table selects the entire row (record) in the table.

4.

On the Form View toolbar, click the Delete Record button to delete the record for Alphonse Moore. Alternatively, press on the keyboard.

The record is removed from the form and a message displays alerting you that you are about to delete a record. If you click Yes and delete the record, you cannot use the Undo button to reverse the action. If you delete a record by mistake, you must re-create the record by re-entering the data.


[Page 1056]

5.

Click Yes to delete the record and reduce the number of records in the table to 12. On the title bar of the Club Members form, click the Close button to close the form.

The Tables object list displays because the Club Members table was selected to create the Club Members AutoForm.

6.

Double-click the Club Members table to open it in Datasheet view. Alternatively, select the table name and click the Open button on the Database window toolbar.

7.

Examine the table and verify that the record for Alphonse Moore no longer displays. Compare your screen with Figure 3.5 and confirm that the new record you added with your name for Student# 22202 is included.

Figure 3.5.


Recall that this form is based on the Club Members table. Your actions of adding and deleting records using the Club Members form updates the records stored in the Club Members table.

8.

On the title bar of the table, click the Close button to close the table.

Activity 3.4. Printing a Form

Like other Access objects, forms can be printed. If you click the Print button, all of the records will print in the form layout that you selected.

1.

On the Objects bar, click Forms, and notice that the Club Members form you just created is listed. Double-click the Club Members form to open it in Form view, and then click the Maximize button on the Club Members form window. On the Form View toolbar click the Print Preview button . In the navigation area, click the Next Page button .


[Page 1057]
In the Print Preview window, the records display in a form layout in a single column. Two pages are needed to print all of the records and the right half of each page is empty.

2.

On the Print Preview toolbar, click the Close button . From the File menu, display the Page Setup dialog box, and then click the Columns tab.

Here you can change the number of columns, row spacing, column width or height, and the column layout of the printed result.

3.

Under Grid Settings, change the Number of Columns to 2 and the Column Spacing to 0.15" Compare your screen with Figure 3.6, and then click OK.

Figure 3.6.


Use two columns to maximize the number of records that display on a page. The space between the columns is adjusted slightly to ensure that the entire width of the two columns will print.

4.

Click the Print Preview button to see how the form will look in a two-column layout. Compare your screen with Figure 3.7 to verify that all of the records display on one page in a two-column layout. In the navigation area, notice that the Next Page arrow is not active, indicating that all of the records will print on one page.


[Page 1058]


Figure 3.7.


Alert!: Does a Warning Box Display?

Depending on your printer, a warning box may display to advise you that the columns will be too wide and some data may be lost. If this displays, click OK and continue with the print process. The adjustment to the column spacing property should be sufficient to enable all of the data to print.

5.

On the Print Preview toolbar, click the Print button , unless you have been instructed to submit your file electronically. Click Close to close the Print Preview window, and then in the upper right corner, click the small Close Window button to close the form. Because you maximized the Form window, your Database window is now maximized on your screen.



[Page 1058 (continued)]




Go! With Microsoft Office 2003 Brief
GO! with Microsoft Office 2003 Brief (2nd Edition)
ISBN: 0131878646
EAN: 2147483647
Year: 2004
Pages: 448
Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net