Filtering Records

In Access XP filtering records may seem confusing at first. This free lesson offers step-by-step instructions.

Introduction

By the end of this lesson, you should be able to:

  • Perform a filter by selection
  • Remove a filter
  • Perform a filter excluding selection
  • Perform a filter by form

Performing a filter by selection

There are times when you might want to view only records that match a specific criterion. A filter is a technique that lets you view and work with a subset of data. Applying a filter to an Access table, form, or query temporarily hides records that don't meet your search criteria. For example, you may only want to work with data pertaining to a specific zip code.

To filter by selection:

  • Click anywhere in the field where you want to filter the records in the table.

    Select Field to be Used in Filter
  • Click the Filter by Selection button in the Standard toolbar, or choose RecordsFilterFilter By Selection from the menu bar to apply the filtering.

    Filter by Selection Option in the Records Menu
  • The filter produces a display that shows only the records that match the filter's definition (e.g., North Carolina). The status area reflects only the filtered records.

    Resulting Display of Filtered Records

Removing a filter

To remove a filter:

  • Click the Remove Filter button on the Standard toolbar, or choose RecordsRemove Filter/Sort from the menu bar.

    Remove Filter/Sort option in the Records Menu
  • The records revert to their ordering before the sort was applied.

    Sort Order When Filter Removed
  • If you want to reapply the filter, click the Apply Filter button (this button acts like a toggle to turn the filter on and off).

Saving a filter

Access defaults to displaying all records in a table. Filters are not initially applied to the table. Filtering table records actually changes the table design. When you attempt to close a table after a filter, Access will prompt you to save the changes to the table design.

To save a filter:

  • Exit the table.
  • Click Yes in response to the question, Do you want to save changes to the table?

    Save Changes Confirmation

    The filter order is saved.

When you open the table or form later, all of the records will be visible. Click the Apply Filter button to reapply the filter. However, Access saves only the last filter you create.

You can apply filters to filtered data to further narrow your search.

To cancel a filter:

  • Exit the table.
  • Click No in response to the question, Do you want to save changes to the table?

    The change is not saved; the table remains in its original design.

Performing a filter excluding selection

A filter excluding selection works in the opposite manner as the filter by selection. Instead of specifying the filter to be used to view records (e.g., everyone in North Carolina), Filter excluding allows you to view data that does not include the specified criterion (e.g., everyone not in North Carolina).

To apply a filter excluding selection:

  • Click anywhere in the field that will be excluded from the filter.

    Select Field To Be Used in Filter
  • Choose RecordFilter Excluding Selection from the menu bar, or right-click and choose Filter Excluding Selection from the shortcut menu.

    Filter Excluding Selection option under the Reports Menu
  • All records except the criterion you excluded are now visible.

    Filtered Records
  • The status area shows only the filtered records displayed on the screen.

Remove this filter by clicking the Remove/Apply Filter button.

Performing a filter by form

The Filter by Form feature is used when you are working in Form view and not in Datasheet view. Filter by form works the same way as the filter by selection method, except filtering is defined on a blank contact data entry form as if you were creating a new contact record.

To filter by form:

  • In Form view or Datasheet view, click the New Record button to create a blank form or datasheet.

    Blank Record Entry
  • Click the Filter By Form button in the standard toolbar.
  • When you click in a field (e.g., State/Province), a drop-down list is opened and displays all of the criteria (filter values) available for selection.

    State/Province drop-down List
  • Select a filter value from the drop-down list (e.g., North Carolina to view all records in North Carolina).
  • To display records meeting more than one search criteria, click the Or tab located at the bottom of the screen. Otherwise, continue to the next step.

    Or Tab Used in the Filtering Process
  • Click the Apply Filter button to apply the filter and view the filtered records.

    View of Filtered Records

Challenge!

  • Open the Contacts table in Datasheet view.
  • Apply the following filter by selection filters:
    • Filter by selection on any record that reveals a State of "North Carolina".
    • Filter by selection on any record that reveals a City of "Cary".
    • Remove the filter.
  • Apply the following filter excluding selection filters:
    • Filter excluding selection on any record that reveals a City of "Cary".
    • Remove the filter.
    • Filter excluding selection on any record that reveals a State/Province of "North Carolina".
    • Remove the filter.
  • Apply the following filter by form filters:
    • Filter by form on the City of "Raleigh".
    • Remove the filter.
  • Close the Contacts table, and if displayed, click No in response to the Do you want to save changes to the design of table 'Contacts'? system prompt.