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.
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.
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.
If necessary, scroll to the right, and then in the Pledge Amount field, click in any record. Click the Sort Descending button .
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.
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.
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.
GO! with Microsoft Office 2003 Brief (2nd Edition)