Objective 1. Sort Records

Sorting is the process of arranging data in a specific order based on the value in each field. For example, you could sort the names in your address book alphabetically by each persons last name, or you could sort your CD collection by the date of purchase.

Initially, records in an Access table display in the order in which they are entered into the table. After a primary key is established, the records are displayed in order based on the primary key field. You can sort data in either ascending order or descending order. Ascending order sorts text alphabetically (A to Z) and sorts numbers from the lowest number to the highest number. Descending order sorts text in reverse alphabetic order (Z to A) and sorts numbers from the highest number to the lowest number.

Activity 2.1. Sorting Records in a Table

Early in the Fall semester, students in various clubs compete to raise money for local charities. In the following activity, you will sort records in the Club Fundraiser database to determine which club has the most number of pledges and which donor made the largest single pledge.


Using the technique you practiced in Chapter 1, open My Computer and navigate to the location where you will store your projects for this chapter. Create a new folder named Access Chapter 2


Locate the file a02A_Club_Fundraiser from the student files that accompany this text. Copy and paste the file to the Access Chapter 2 folder you created in Step 1. Using the technique you practiced in Activity 1.1 of Chapter 1, rename the file 2A_Club_Fundraiser_Firstname_Lastname Close My Computer, Start Access, and then open your 2A_Club_Fundraiser database.


On the Objects bar, be sure Tables is selected, and then double-click Pledges to display the table in Datasheet view. Maximize the table window.

The records are sorted in ascending order by Pledge#, which is the primary key field. Recall that the primary key is the field whose value uniquely identifies each record in a tableeach pledge of money made by a donor has a unique number.


In the Club Affiliation field, click in any record, and then on the Table Datasheet toolbar, click the Sort Ascending button . Compare your screen with Figure 2.2.

Figure 2.2.
(This item is displayed on page 971 in the print version)

To sort records, first click any record in the column on which you want to sort. The records display in alphabetical order by Club Affiliation. Because like names are now grouped together, you can quickly scroll the length of the table and see that the Culinary Arts Club has collected the greatest number of pledges.

[Page 971]


If necessary, scroll to the right, and then in the Pledge Amount field, click in any record. Click the Sort Descending button .

The records in the table are sorted by Pledge Amount, with the largest pledge amount listed first. You can see that the largest single pledge amount is for $100 from Ranjan Biswas.

Activity 2.2. Sorting Records on Multiple Fields

James Smith would like to see the dollar amounts pledged by donors, from the largest to the smallest, within each club. Access enables you to sort on two or more fields in a table in this manner. To do so, the fields must be positioned next to each other.


Click the Pledge Amount field heading to select the column, and then point to the selected Pledge Amount column heading. When the white selection pointer displays, drag the Pledge Amount column to the left until a black vertical line displays on the right boundary of the Club Affiliation column, and then release the mouse button.

As you drag the column, a dark line displays between columns to indicate where the field will display when you release the mouse button. A small rectangular shape displays on the tail of the mouse pointer as the column is moved.

[Page 972]


With the Pledge Amount column still selected, hold down and click the Club Affiliation column heading to select both columns, and then on the Table Datasheet toolbar, click the Sort Ascending button . Compare your screen with Figure 2.3.

Figure 2.3.

The records are sorted left to right. That is, the records are sorted first by Club Affiliationthe leftmost selected columnand then within a specific Club Affiliation, the sort continues in ascending order by Pledge Amount. Within Club Affiliation, the club names are sorted alphabetically in ascending order, and then within each club, the Pledge Amount is sorted in ascending order (lowest to highest).

In a table, you cannot perform a sort on multiple fields using both ascending and descending orderyou must use one or the other.


In the Pledge# field, click any record, and then click the Sort Ascending button to return the records in the table to the original sort order.

[Page 973]

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