Try the Access Course for Free!

Sort a Query in Access – Instructions

/ / Access 2013, Access 2016, Access 2019, Access for Office 365, Latest, Microsoft, Office 2013, Office 2016, Office 2019, Office 365

Sort a Query in Access: Video

            This video lesson, titled “Sorting Query Results,” shows how to sort a query in Access in different ways. This video is from our complete Access tutorial, titled “Mastering Access Made Easy v.2019 and 365.”

Overview of Sorting a Query in Access

            You can sort a query in Access by any field within the QBE grid when viewing the query in design view. To sort a query in Access when in design view, click into the “Sort” row of the field in the QBE grid by which to sort the result set. Then use the drop-down that appears to select either “Ascending” or “Descending” order.

            If you sort by multiple fields in Access, the order of the sorting is applied by field, from left to right, when viewing the result set. When sorting this way, you include the sorting criteria in the query’s SQL code. This then sorts the query result set the same way each time you run the query. To remove this type of query sorting, select the “(not sorted)” choice from the “Sort” row’s drop-down for the field from which to remove sorting in the QBE grid.

            Alternatively, you can apply sorting to a query result set in Access without changing its SQL code. Doing this only changes the way that the query result set appears while you view it in datasheet view.

            To sort by fields when viewing the query result set in datasheet view in Access, click the drop-down arrows at the top of the columns by which to sort the data. Then select either “Sort A to Z” or “Sort Z to A” from the drop-down. Alternatively, select a column. Then click either the “Ascending” or “Descending” buttons in the “Sort & Filter” button group on the “Home” tab of the Ribbon. To remove all sorting from the query result set, click the “Remove Sort” button in the “Sort & Filter” button group on the “Home” tab of the Ribbon.

A picture that shows how to sort a query in Access in datasheet view by using the buttons in the “Sort & Filter” button group on the “Home” tab of the Ribbon.

A picture that shows how to sort a query in Access in datasheet view by using the buttons in the “Sort & Filter” button group on the “Home” tab of the Ribbon.

            Alternatively, to use the ORDER BY clause in the SQL View of an Access query to sort a query in Access, please see our other blog post on “How to Use the ORDER BY Clause in SQL. That blog post contains additional information and links about how to use the ORDER BY clause to sort query results when writing queries in SQL View in Access.

Instructions on How to Sort a Query in Access

  1. To sort a query in Access in the query design view, click into the “Sort” row of the field in the QBE grid by which to sort the result set.
  2. Then use the drop-down that appears to select either “Ascending” or “Descending” order.
  3. If you sort by multiple fields in the query design view in Access, the order of the sorting is applied by field, from left to right, when viewing the result set.
  4. When sorting this way, you include the sorting criteria in the query’s SQL code. This then sorts the query result set the same way each time you run the query.
  5. To remove this type of query sorting, select the “(not sorted)” choice from the “Sort” row’s drop-down for the field from which to remove sorting in the QBE grid.
  6. Alternatively, to sort a query result set in Access when viewing it in datasheet view, click the small drop-down arrows at the top of the columns by which to sort the data.
  7. Then select either “Sort A to Z” or “Sort Z to A” from the drop-down that appears.
  8. Alternatively, select a column and then click either the “Ascending” or “Descending” buttons in the “Sort & Filter” button group on the “Home” tab of the Ribbon.
  9. To remove all sorting from the query result set, click the “Remove Sort” button in the “Sort & Filter” button group on the “Home” tab of the Ribbon.
TOP