• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Sorting Query Results

Rather than present your query results in the order that they occur in the component tables and queries, you can establish a sort order for the query's results based on the values in one or more fields of your results. For instance, you could create a query to find author names and sort the results of that query alphabetically by last name. You can establish different sort orders for different fields.

To sort query results:

1.
Open (or create) your query in Design view.

2.
Arrange the fields in your query so the first field to sort by is the farthest to the left, the second field is next farthest to the left, and so forth (Figure 7.24).

Figure 7.24. Access sorts the results of your query based on the fields'left-to-right order in the query design grid.


If you want Access to sort your query results based on the values in two fields, those two fields don't need to be the first and second fields in the query, but the fields must be in the proper left-to-right order in the query design grid.

3.
Click the Sort cell of a field you want to sort your results by, and then click the drop-down menu that appears. Select the sort method you want to employ for that field (Figure 7.25).

Figure 7.25. Select the sort method you want to apply to each field in your results.


You can sort your results according to the selected field's values in ascending or descending order.

4.
Choose the sort method to use for your other fields and click the Run button to see your results.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint