Microsoft Office Tutorials and References
In Depth Information
Editing a Query
Sorting a query
You can sort or alphabetize the results of a query in several ways. The first
way is to use the Sort row in the design grid. Use the Sort row to tell Access
which field to use to sort the datasheet. The second way is to click the Sort
Ascending and Sort Descending buttons on the Home tab of the Ribbon
when a datasheet is displayed. (For more on sorting in a datasheet, see
Book II, Chapter 3.)
If you summarize a query by month, Access alphabetizes the months —
which usually isn’t what you want. Reports, on the other hand, know how to
put months in chronological order. If you have monthly data that you want
to sort, a report is a better object to use than a query.
To sort by a field, display your query in Design view and then follow
these steps:
1. Move the cursor to the Sort row in the column that contains the field
by which you want to sort the records that the query selects.
2. Display the drop-down menu for the Sort row.
Access displays the options for sorting: Ascending, Descending, and
(not sorted).
Book III
Chapter 1
3. Choose to sort in ascending order or descending order.
You can use the Sort row in the design grid to sort by more than one field.
Suppose that you want to sort the records in the datasheet by last name, but
several people have the same last name. You can specify another field (per-
haps First Name) as the second sort key.
When you sort by using more than one field, Access always works from left
to right, first sorting the records by the first field (the primary sort key) that
has Ascending order or Descending order in the Sort row and then using
the second sort key to sort any records that have the same primary sort
key value.
You can’t sort by the following field types: OLE Object, Attachment, and
multivalue fields.
Viewing top values
If all you care about are the top values produced by a query, you can tell
Access to find and display only those records. Use the Return (Top Values)
box on the Design View toolbar to see the top records produced by the
query. A value in the Return (Top Values) box specifies exactly how many
records in the datasheet you want to display; a percentage shows you the
percentage of those records that the query finds.
Search JabSto ::




Custom Search