Home

Sorting String-Based Fields

 

Introduction

Most fields of a database contain strings. This allows you to sort them in alphabetical order. When sorting the strings of a column, Microsoft Access refers to the language of the computer set in the Control Panel. That language defines its alphabetical rules. This also implies that the rules in one language are not necessarily the same in another language.

To sort the records of a table or query, you must specify the field that would be used as the reference. To do this, on the table or query, click a field under the column of your choice. To arrange the list in alphabetical order, click the column header or a field under the column.

 

Visually Sorting String Records

Consider the following table:

Real Estate Properties

When many records have the same value for the Property Type column, you can ask Microsoft Access to sort the records based on the type of property. In this case, as seen previously, the empty records would come first. Then, the records that have Condominium as value would display, followed by the records that have Single Family, and so on. When sorting the records, the table, query, or form must still keep each record complete. Therefore, after displaying the field in the order, its corresponding fields are displayed in their equivalent columns. In this case, the property number, the condition, the city, and the state corresponding to the property type would display on the same row with the property type. For example, notice the property whose type is Condominium, its property number being 200417, its condition being Excellent, its city being Germantown, and its state being MD. When the records have been sorted alphabetically, the whole record is kept the same, just at a different position:

To sort the records, identify and click the column header, a cell under a column, a control, or its label. Then, in the Sort & Filter section of the Ribbon, click the Ascending button Ascending.

You can also right-click to sort the list:

  • Click the down pointing arrow button on the right side of the name of the column and click Sort A to Z
  • Right-click the column header or a field under the column and click Sort A to Z

Besides the regular arrangement of records, you can also sort records in reverse alphabetical order. To do this, click the column header or a field under the column header. Then, in the Sort & Filter section of the Ribbon, click the Descending button Descending.

You can also right-click to sort the list in reverse order:

  • Click the down pointing arrow button on the right side of the name of the column and click Sort Z to A
  • Right-click the column header or a field under the column and click Sort Z to A

When you have finished sorting, it is sometimes important to reset the table before continuing unless you want to keep the list sorted.

To sort records on a form in Form View or Tabular View, click the control or its accompanying label. Then, in the Sort & Filter section of the Ribbon, click the Ascending button Ascending

Sort Ascending

As mentioned for the table or query, to arrange the strings in alphabetical order, right-click the control or its label and click Sort A to Z.

To sort the records in reverse alphabetical order, click the control or its label and, in the Sort & Filter section of the Ribbon, click the Descending button Descending.

You can also right-click. To arrange the list in reverse alphabetical order, right-click the control or its label and click Sort Z to A.

 

Home Copyright © 2008-2012 FunctionX