Access 2010
More Query Design Options
Sorting queries
Access allows you to apply multiple sorts at once while you're designing your query. This allows you to view your data exactly the way you want, every single time you view it.
A sort that includes more than one sorted field is called a multilevel sort. A multilevel sort allows you to apply an initial sort, then further organize that data with additional sorts. For instance, if you had a table full of customers and their addresses, you might choose to first sort the records by city, then further sort them alphabetically by last name.
When more than one sort is included in a query, Access reads the sorts from left to right. This means the leftmost sort will be applied first. In the below example, then, customers will be sorted first by the City they live in and then by the Zip Code within that city.
To apply a multilevel sort:
- Open the query, and switch to Design View.
- Locate the field you would like to sort first. In the Sort: row, click the drop-down arrow to select either an ascending or descending sort.
Applying an Ascending sort to a field
- Repeat the process in the other fields to add additional sorts. Remember, the sorts are applied from left to right, so any additional sorts must be applied to fields located to the right of your primary sort. If necessary, you can rearrange the fields by clicking a field and dragging it to a new location.
A multilevel sort
- To apply the sort, click the Run command.
The Run Query command
- Your query results will appear with the desired sort.
The sorted query results
You can also apply multilevel sorts to tables that don't have queries applied to them. On the Home tab on the Ribbon, select the Advanced drop-down command in the Sort & Filter group. Select Advanced Filter/Sort, and create the multilevel sort as you normally would. When you're finished, click the Toggle Filter command to apply your sort.