Microsoft Office Tutorials and References
In Depth Information
Recall that in Tutorial 1 you used the Sort Ascending button to sort query results by the
StateProv field. You’ll use this same button to sort the EmployerPositions query results by
the EmployerName field.
To sort the records using a toolbar sort button:
1. Click any visible EmployerName field value to establish the field as the current field
2. Click the Sort Ascending button on the Query Datasheet toolbar. The records are
rearranged in ascending order by employer name. See Figure 3-13.
Sorting records on a single field in a datasheet
in ascendi ng
After viewing the query results, Matt decides that he’d prefer to see the records arranged
by the value in the PositionTitle field, so that he can identify the types of positions he needs
to fill. He also wants to display the records in descending order according to the value of
the Openings field, so that he can easily see how many openings there are for each posi-
tion. In addition, he wants the Openings field values to be displayed in the rightmost col-
umn of the query results so that they stand out in the query datasheet. To produce the
results Matt wants, you need to sort using two fields.
Sorting Multiple Fields in Design View
Sort fields can be unique or nonunique. A sort field is unique if the value of the sort field
for each record is different. The EmployerID field in the Employer table is an example of a
unique sort field because each employer record has a different value in this field. A sort
field is nonunique if more than one record can have the same value for the sort field. For
example, the PositionTitle field in the Position table is a nonunique sort field because
more than one record can have the same PositionTitle value.
When the sort field is nonunique, records with the same sort field value are grouped
together, but they are not in a specific order within the group. To arrange these grouped
records in a specific order, you can specify a secondary sort field , which is a second field
that determines the order of records that are already sorted by the primary sort field (the
first sort field specified). Note that the primary sort field is not the same as a table’s pri-
mary 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 field.