Objective 5. Add Records to a Table

When you buy a new address book, it is not very useful until you fill it with names, addresses, and phone numbers. Likewise, a new database is not useful until you populate, or fill, a table with data. After a table is created, you can populate it with records by typing data directly into the table.

Activity 1.12. Adding Records to a Table

1.

On the Table Design toolbar, click the View button to switch to the Datasheet view, and notice the column names, which are the Field Names you created in Design view. Because the Pledge# field was defined as an AutoNumber data type, (AutoNumber) displays in the record box under this field name. Similarly, because Pledge Amount was defined as a Currency data type, $0.00 displays in the record box under this field.

2.

With your table in Datasheet view, press to move to the Student# field and type 10157

As soon as information is entered in the Student# field, Access enters an AutoNumber1in the Pledge# field. Recall that the Student# field size is set to five characters. If you try to enter more than five characters in this field, the computer will beep to warn you that your entry cannot be accepted.

3.

Press to move to the Student Last Name column, and then type Hernandez Press to move to the Donor First Name column, type Maria and then press to move to the Donor Last Name column and type Rios

4.

Press , and then in the Donor Phone column type (312) 555-0012 Press and in the Pledge Amount field type 20

Because you set the property for the Pledge Amount field as currency when you were designing the table, it is not necessary to type a dollar sign when entering values in this field. However if a value includes cents, you must type a decimal before you type the amount to the right of the decimal.

5.

Press and then in the Date Collected column type 11/15/07

Depending on the settings for your computer, the year may display with two or four digitsas 07 or 2007. Regardless of the way it displays, you can enter it using two digits.

NoteCorrecting Typing Errors

Use the same techniques used in documents and worksheets.

If you make a mistake while entering data, you can correct the error by using the Backspace key to remove characters to the left, the Delete key to remove characters to the right, or select the text you want to replace and type the correct information. You can also press to exit out of a new record.


[Page 900]

6.

Press to move to the next row in the table, and then press to move to the Student# field. Continue entering the records shown in the following list, and do not be concerned if the data does not completely display in the column; the widths of the columns in the figure have been adjusted so that you can view the data that is to be entered. When you are finished, compare your screen with Figure 1.32.

Figure 1.32.

Pledge#

Student#

Student Last Name

Donor First Name

Donor Last Name

Donor Phone

Pledge Amount

Date Collected

2

22055

Flores

Josephine

Schultz

(312) 555-0136

$37.50

 

3

22101

Hill

Emily

Allen

(312) 555-0721

$25.00

11/20/07

4

11432

Butler

Judy

Rhoades

(312) 555-0922

$35.00

 

5

22101

Hill

Angela

Vroom

(312) 555-0426

$10.00

11/22/07

As soon as you move to the next row, the first record is savedyou do not have to take any specific action to save the record.

7.

On your 1B Pledges table title bar, click the Close button to close the table and display the Database window.


[Page 901]

Activity 1.13. Creating a Second Table

When you see duplicate information in a table, it may be a signal that you have an inefficient database design. For example, in your 1B Pledges table, the student name Hill already appears twice. When you see the same data repeating itself within a table, it is likely that another table is necessary. In this activity, you will create a second table in your database.

1.

In the Database window, double-click the Create table in Design view command.

Your 1B Pledges table keeps track of pledges that have been made; it includes a Student# field and a field for the students last name. As individual students receive multiple pledges, this information will be duplicated within the 1B Pledges table. The students last name is information about the studentnot about the pledgesand thus belongs in a separate table of student club members. In the 1B Pledges table, having the Student# field is sufficient to track the student club member to whom the pledge was made.

2.

In the first Field Name box, type Student# press twice, and then press to jump to the Field Size property. Use as a quick way to move the insertion point between the currently active field and the Field Properties area. Text is accepted as the Data Type for the Student# field. Recall that if a number will not be used in mathematical calculations, a field that uses numbers can be designated as Text.

3.

Set the Field Size of the Student# field to 5 and then press to return to the Description column for the first field.

Recall that limiting a field size is one way you help ensure data accuracy. In this instance, it will prevent too many characters from being entered into this field.

4.

Press to move to the second row and continue to enter the field names, data types, and field sizes as listed below:

Field Name

Data Type

Field Size

First Name

Text

15

Last Name

Text

25

Phone

Text

15

Email Address

Text

50

Club Affiliation

Text

50

5.

Click anywhere in the Student# field and then, on the Table Design toolbar, click the Primary Key button .

Recall that a primary key is used to uniquely identify each record. Every student at the college has a unique (different) student number.


[Page 902]

6.

On the Table Design toolbar, click the Save button . In the Save As dialog box, and using your own name, type 1B Club Members Firstname Lastname click OK, and then compare your screen with Figure 1.33.

Figure 1.33.

More Knowledge: Changing Field Size After Records Are Entered

If you change the field size or other properties after records have been entered in a table, you may see a message box warning that the change may affect the data. For example, if you change a field size in a table with data from 50 to 10, if any of the data in the table requires more than ten characters, the data will be lost. For this reason, it is best to set the field size before adding data. However, if you change the field size to a smaller size after the data has been entered, be sure that the size is large enough to accommodate the largest entry.


[Page 903]

Activity 1.14. Adding Records to the Second Table

1.

On the Table Design toolbar, click the View button to switch to Datasheet view.

2.

Beginning in the first row, under Student#, and using the techniques you have practiced, enter the following five records, and then compare your screen with Figure 1.34. Do not press to try to force the data to a second line. This action will move the insertion point to the next field. Note that the columns in the Figure have been adjusted to display all the data. Later you will learn how to widen columns so that all of the data displays.

Figure 1.34.

Student#

First Name

Last Name

Phone

Email Address

Club Affiliation

10157

Carlos

Hernandez

(312) 555-0712

CHernandez57@lmcc.edu

Accounting Student Association

22055

Emmeline

Flores

(773) 555-0076

EFlores55@lmcc.edu

Student Vocational Nursing Association

22101

Justin

Hill

(773) 555-0067

JHill01@lmcc.edu

Entrepreneurs of LMCC

11432

Jeffrey

Butler

(708) 555-0098

JButler32@lmcc.edu

Culinary Arts Club

10125

Ranjan

Biswas

(312) 555-0054

RBiswas25@lmcc.edu

International Business Students Association

3.

On your 1B Club Members table title bar, click the Close button .

Recall that each record is saved as you move the insertion point to another record or when you close the table.

[Page 904]

Категории

© amp.flylib.com,