Back to Tutorial

Lesson 10: Sorting Records

/en/access2007/making-forms-attractive/content/

Introduction

Access 2007 Once a database is populated, it's time to think about how to look at—or analyze—the data. One basic way to analyze data is to sort it. Sorting data is easy with Access 2007. In this lesson, we'll show you how to sort text-based and numerical data using common sorting commands, as well as how to clear sorts.

Sorting records

Sorting records

Sorting is probably the simplest way to look at data because it keeps similar things together. In our bookstore database, for example, we could sort our data a few ways:

  • We could sort orders based on the order date.
  • We could sort customers by the state in which they live or by their zip codes.
  • We could sort our books by author, category, or price.

Access 2007 allows you to sort the records in your database tables based on a field or value that is either text—like an author's last name—or numerical—like a customer's zip code or a book's price. Depending on the type of value, Access offers different sorting options.

Sorting on text values

When Access 2007 sorts on a text value, it offers the two options described in the table below:

Sort OptionAlso CalledDescription
A to ZAscendingValues closest to A are displayed first
Z to ADescendingValues closest to Z are displayed first

To sort based on a text value:

  • Click the drop-down arrow at the top of the field you want to sort.


    A to Z SortSorting A to Z
  • When the menu appears, select either the Sort A to Z or the Sort Z to A option.
    • With A to Z, the records will be sorted based on the chosen field's value with the value closest to A at the top of the table, as seen below.


      A to Z Sort ResultsRecords Sorted A to Z on Category
    • With Z to A, the records will be sorted the using the chosen field's value with the value closest to Z at the top of the table.

    The sort command section in the Sort group on the Ribbon is another way to begin a sort.

Sorting on numerical values

Access 2007 also offers two options when sorting based on a numerical value. These options are described in the table below:

Sort OptionAlso CalledDescription
Smallest to LargestAscendingValues closest to 1 are displayed first
Largest to SmallestDescendingValues farthest from 1 are displayed first

To sort based on a numerical value:

  • Click the drop-down arrow at the top of the field you want to sort.


    Largest to Smallest SortSorting Largest to Smallest
  • When the menu appears, select either the Lowest to Highest or the Largest to Smallest option.
    • With Smallest to Largest, records will be sorted based on the chosen field's value, with the value closest to 1 at the top of the table.
    • With Highest to Lowest, records will be sorted the using the chosen field's value, with the value farthest from 1 at the top of the table, as seen below.


      Largest to Smallest Sort ResultsRecords Sorted Largest to Smallest on Price

    The sort commands in the Sort & Filter group on the Ribbon can also be use to begin a sort.

    To clear a sort:

    • Click the Clear Sort command in the Sort & Filter group on the Ribbon.
Clear All SortsClear All Sorts Command

Challenge!

If you haven't already done so, save the sample Ready2Read database to your computer.

  • Open the Customers table and the Books table.
  • Sort the Last Name field in the Customers table from Z to A.
  • Sort the Books table according to Price using the Lowest to Highest option.
  • Clear your sorts.

/en/access2007/filtering-records/content/