Sorting Data Sorting is the process of rearranging records in a specified order or sequence.

Download Report

Transcript Sorting Data Sorting is the process of rearranging records in a specified order or sequence.

Sorting Data
Sorting is the process of rearranging records in a
specified order or sequence. When you sort data in a
query or table datasheet or in a form or other object,
you do not change the sequence of records in the
underlying table(s). Only the records that appear in the
object, such as a query datasheet, are rearranged
according to your specifications.
Click your mouse to continue
Sort Keys
To sort records, you must select the sort key, which is
the field used to determine the order of records in the
object. Sort keys can be text, number, date/time,
currency, AutoNumber, yes/no, or Lookup Wizard fields,
but not memo, OLE object, or hyperlink fields. You can
sort records in either ascending (increasing) or descending
(decreasing) order.
Click your mouse to continue
Sorting Results for Different Data Types
Data Type
Ascending Sort Results
Descending Sort Results
Text
A to Z
Z to A
Number
lowest to highest numeric value
highest to lowest numeric value
Date/Time
oldest to most recent date
most recent to oldest date
Currency
lowest to highest numeric value
highest to lowest numeric value
AutoNumber lowest to highest numeric value
highest to lowest numeric value
Yes/No
No then Yes values
Yes (check mark in check box) then
No values
Click your mouse to continue
Using Toolbar Buttons to Sort Data
The Sort Ascending ( ) and Sort Descending ( )
toolbar buttons allow you to sort records immediately,
based on the selected field. First, you select the column
on which you want to base the sort by placing the
insertion point anywhere in the column. Then you click
the appropriate sort toolbar button to rearrange the
records in either ascending or descending order. Unless
you save the object after you’ve sorted the records, the
rearrangement of records is temporary.
Click your mouse to continue
Unique and Nonunique Sort Keys
Sort keys can be unique or nonunique. A sort key is
unique if the value of the sort key field for each record is
different. The Client# field in the Client table is an
example of a unique sort key because each client record
has a different value in this field.
A sort key is nonunique if more than one record can
have the same value for the sort key field. For example,
the ContractDate field in the Contract table is a nonunique
sort key because more than one record can have the
same ContractDate value.
Click your mouse to continue
Sorting Multiple Fields—1 of 2
When the sort key is nonunique, records with the same
sort key value are grouped together, but they are not in
any specific order within the group. To arrange these
grouped records in a specific order, you can specify a
secondary sort key, which is a second sort key field.
The first sort key field is called the primary sort key.
Note that the primary sort key is not the same as a
table’s primary key field. A table has at most one primary
key, which must be unique, whereas any field in a table
can serve as a primary sort key. Access lets you select up
to 10 different sort keys for any one sort.
Click your mouse to continue
Sorting Multiple Fields—2 of 2
When you use the toolbar sort buttons to sort multiple
fields, the sort key fields must be in adjacent columns in
the datasheet. You highlight the columns, and Access
sorts first by the first highlighted column and then by
each other highlighted column in order from left to right.
If you want to sort on multiple fields that are nonadjacent
or in the wrong order, but you do not want to rearrange
the columns in the datasheet to accomplish the sort, you
must specify the sort keys in Design view.
You must also use Design view when you want a mixture
of ascending and descending sorts for the sort keys.
Click your mouse to continue