Home

Sorting and Filtering Boolean Fields

 

Introduction

A Boolean field is one that holds a true or false result and it is created as a Yes/No type. By default, and most of the time, a Boolean field displays a check box that can be checked (or marked) or cleared (or unchecked). By its Boolean interpretation, Microsoft Access considers that a check box that is checked is "selected" and a check box that is not checked in "cleared". You can use this logic to sort the records of a table, a query, or a form.

You can sort the Boolean records as selected or cleared. As it should seem obvious, when you sort in selected order, the checked boxes would come up first. To sort the Yes/No records of a table, a query, or a form, in selected order, you can:

  • Right-click the column header or a check box under the column header on a table or a query, or right-click the check box or its accompanying label on a form, and click Sort Selected to Cleared
  • Click the down-pointing button on the right side of the name of the column and click Sort Selected to Cleared
     
  • Give focus to the check box but do not click. To give focus to a check box without clicking,
    • On a table or a query, if there is a cell on the left column to the check box, click that cell and press Tab
    • On a table or a query, if there is no cell on the left side of the check box but there is a column on the right side with a cell, click that cell and press Shift + Tab 
    • On a table or a query, click any cell other than the one with the check box you want to give focus to. On a form, click any control or label other than the one with the check box you want to give focus to. Press Tab to move up the index sequence or Shift + Tab to move down the index sequence, until the check box receives focus.

      In all cases, you will know that the check box has focus when it is surrounded with a dotted square line.

    Once the check box has received focus, in the Sort & Filter section of the Ribbon, click the Ascending button Ascending

To sort the Boolean records in cleared order:

  • Right-click the column header or a check box under the column header on a table or a query, or right-click the check box or its accompanying label on a form, and click Sort Selected to Cleared
  • Click the down-pointing button on the right side of the name of the column and click Sort Cleared to Selected
  • Give focus to the check box and, in the Sort & Filter section of the Ribbon, click the Descending button Descending

To put the list back in the sequence it previously had, in the Sort & Filter section of the Ribbon, click the Clear All Sorts button Clear All Sorts.

Filtering Boolean Records

If you have a column created as a Yes/No type, you can isolate the list with only checked or only cleared fields. To filter records that are checked:

  • Right-click a check box (checked or not) under the column and click Is Selected
     
  • Click the column header or give focus to a check box under it. In the Sort & Filter section of the Ribbon, click Selection and click Is Selected

After clicking, the table, query, or form would display only the records that have that field checked.

To filter records by the cleared check boxes:

  • Right-click a check box (checked or not) under the column and click Is Not Selected
  • Click the column header or give focus to a check box under it. In the Sort & Filter section of the Ribbon, click Selection and click Is Not Selected

After clicking, the table, query, or form would display only the records that have that field cleared.

 

Home Copyright © 2008-2012 FunctionX