Home

Introduction to Filtering Records

Fundamentals of Filtering Records

Introduction

Data analysis consists not only of selecting records but also of setting some conditions by which the records should be presented. A condition is set as if using a funnel that decides what to let through and what to exclude. The condition or rule is also called a criterion.

A filter is a criterion or a set of criteria that must be applied to a set to create a list of records that abide by a common rule. Filters can be used to isolate records on a table, a query, a form, or a report. There are differences on the way each type of value handles a filter.

Practical Learning: Introducing Records Filtering

  1. Start Microsoft Access
  2. On the list of fields, click States Statistics2 from the previous lesson
  3. In the Navigation Pane, double-click the States table
  4. If necessary, on the Ribbon, click Home.
    Change the following characteristics:
    Font Name: Bookman Old Style (if you don't have that font, select Times New Roman)
    Font Color: Gold, Accent 4, Lighter 80% (Theme Colors: 8th column, 2nd row)
    Background Color: Blue, Accent 1, Darker 50% (Theme Colors: 5th column, 6th row)
    Alternate Row Color: Blue, Accent 1 (Theme Colors: 5th column, 1st row)

    Table - Sorting Records

Filtering Records

Microsoft Access provides various techniques to filter records. To visually filter records, you can right-click the list or use buttons in the Sort & Filter section in the Home tab of the Ribbon.

Removing a Filter

When a table, a query, a form, or a report is filtered, in the Sort & Filter section of the Ribbon, the Toggle Filter button is highlighted Toggle Filter. Also, the bottom section of the table, query, or form displays a Filtered button Filtered. If you perform another filter on the list, only the selected records would be considered. This means that you must decide whether you want the new filtering to apply to all records or only to the new ones. If you want to use all records of the list, you must first remove the previous filter.

To dismiss the previous filtering operation:

Saving Data Analysis Results

Every time you finish analyzing data, you can dismiss the result or save it. If you don't save the result, all the analysis will be lost. The best way to save the results of data analysis is by storing them in a query. Besides the ability to save sorted and/or filtered lists, queries provide advanced techniques of performing data analysis. Because they use the SQL, they use a syntax that is not directly available to tables, forms, and reports. In fact, queries provide a good alternative to creating the record source that can be used to populate a form or a report.

Introduction to Filtering by Selection

Overview

Imagine you have a list where some records share a certain value. Based on such a field, you can retrieve a list that includes only the particular string, that is, records that share that value. This is referred to as as filtering by selection.

Filtering by Selection for Equality

To get a list of all records that hold the exact same value as that of your choice, in the Datasheet View of a table, the Datasheet View of a Query, the Datasheet View of a form, the Form View of a form, the Report View or the Layout View of a report:

After clicking, the object will display only the records that share the specified in the field.

Practical Learning: Filtering for Equality

  1. To see only the states in New England, in the Region column, right-click New England and click Equals "New England"

    Filtering

    Filtering

  2. On the table, right-click New England and click Clear Filter From Property Type

    Clearing a Filter

Filtering Records by Design

Another way to filter records is while you are designing a table, a query, a form or a report. In order to see the results for a table, you must first save it. If you save the table like that, the filtering feature would be included in the table.

To filter records in design, display the object in Design View. Use the Property Sheet of the table, use the bottom part of the field that will use the filter for a query, user the Record Source for the form or report.

Filtering for Un-Equal Values

To filter for records that are not equal to a certain value, in a table, a query, a form, or a report:

Practical Learning: Filtering for Un-Equal Sub-Strings

  1. To see the states outside of New England, in the Region column, right-click New England and click Does Not Equals "New England"

    Filtering

    Filtering

  2. In the bottom section of the table, click the Filtered button Filtered
  3. Close the table without saving it
  4. On the Ribbon, click File and click Open
  5. From the recources that accompany these lessons, open the Altair Realtors2 database
  6. In the Navigation Pane, right-click the Properties table and click Copy
  7. Right-click an unoccupied area of the Navigation Pane and click Paste
  8. Set the name to Ready for Sale and click OK
  9. In the Navigation Pane, double-click the Ready for Sale table
  10. In the Home tab of the Ribbon, change the following characteristics:
    Font Name: Calisto MT (if you don't have that font, select Times New Roman)
    Font Color: Orange, Accent 2, Lighter 80% (Theme Colors: 6th column, 2nd row)
    Background Color: Dark Red (Standard Colors: 1st column, 7th row)
    Alternate Row Color: Maroon 4 (Standard Colors: 6th column, 5th row)

    Introducing Logical Disjunction

Filtering by Selection and Type

Filtering by Selection for Numbers

If the data type of the field by which you want to filter records is number-based, you can find records that use the same value or those that use different values. You can also find records that use a higher or lower value. To make your selection, right-click the value or use the Selection button of the Ribbon as we saw earlier.

Practical Learning: Filtering by Selection for Numbers

  1. In the Bedrooms column, right-click 4 and click Equals 4

    Filtering by Selection for Numbers

  2. Click the button on the right side of Bedrooms and click Clear Filter From Bedrooms
  3. In the Market Value column, right-click $555,540 and click Less Than or Equal To $555,540.00

    Filtering by Selection for Numbers

    Filtering by Selection for Numbers

  4. In the bottom side of the table, click the Filtered button

Filtering by Selection for Date/Time Values

If the data type of the field by which you want to filter records is a date or time-based, you can find records that occur:

Practical Learning: Filtering by Selection for Date/Time Values

  1. Open the States Statistics2 database used earlier
  2. In the Navigation Pane, right-click the Summary report and click Layout View
  3. On the report, find one of the Dakotas (north or south) and right-click its Date record

    Filtering by Selection for Date/Time Values

  4. Click the Equals option:

    Filtering by Selection for Date/Time Values

  5. On the Ribbon, click the Toggle Sort button
  6. On the report, right-click the Date value for Maine and click On Or Before 3/15/1820

    Filtering by Selection for Date/Time Values

    Filtering by Selection for Date/Time Values

  7. Close the report without saving it

Filtering by Selection for Boolean Values

If a field uses Yes/No values or check boxes in a form or report, you can get all records that are true (or checked) or all those that are false (or unchecked/cleared).

Practical Learning: Filtering by Selection for Boolean Values

  1. Open the Altair Realtors2 database used earlier
  2. In the Navigation Pane, double-click the Properties table
  3. In the Home tab of the Ribbon, change the following characteristics:
    Font Name: Calisto MT (if you don't have that font, select Times New Roman)
    Font Color: Orange, Accent 2, Lighter 80% (Theme Colors: 6th column, 2nd row)
    Background Color: Dark Red (Standard Colors: 1st column, 7th row)
    Alternate Row Color: Maroon 4 (Standard Colors: 6th column, 5th row)
  4. Right-click a checkd box in the Basement column

    Filtering by Selection for Boolean Values

  5. Click IsSelected

    Filtering by Selection for Boolean Values

  6. In the bottom side of the table, click the Filtered button Filtered
  7. Right-click an unchecked box in the Indoor column and click Is Not Selected

    Filtering by Selection for Boolean Values

  8. In the bottom side of the table, click the Filtered button Filtered

Filtering by Selection for Null Records

If a field is missing some values, you can find records that are empty or those that contain values.

Practical Learning: Filtering by Selection for Null Records

  1. Right-click an empty cell below State and click Equals Blank

    Filtering by Selection for Null Records

    Filtering by Selection for Null Records

  2. In the bottom side of the table, click the Filtered button Filtered
  3. Close the table without saving it

Strings and Filtering by Selection

Introdution

If you have a set of records with a string-based column, you may want to get a list of records that share a detail inside the string, also called a sub-string. To exercise an advanced level of control on the sub-string or the combination of (sub) strings, right-click any field under the column, position the mouse on Text Filters and choose one of the options. The Custom Filter dialog box would come up. When using the Custom Filter dialog box, you can type an exact string or use some characters to create an approximate string.

Filtering by a Contained Sub-String

To filter by an exact sub-string that is contained in a string, first select the sub-string. Then:

When using the Contains option, you must first select a string or a sub-string. In some cases, you may want the string to contain one or more characters or sub-strings.

Practical Learning: Introducing Filtering by a Contained Sub-String

  1. Open the States Statistics2 database used earlier
  2. In the Navigation Pane, double-click the States table
  3. If necessary, on the Ribbon, click Home.
    Change the following characteristics:
    Font Name: Bookman Old Style (if you don't have that font, select Times New Roman)
    Font Color: Gold, Accent 4, Lighter 80% (Theme Colors: 8th column, 2nd row)
    Background Color: Blue, Accent 1, Darker 50% (Theme Colors: 5th column, 6th row)
    Alternate Row Color: Blue, Accent 1 (Theme Colors: 5th column, 1st row)
  4. On the table, in the State column, select nn in Connecticut
  5. To get a list of states that include two consecutive Ns in their name, right-click the nn selected and click Contains "nn":

    Filtering for Records that Contain a Certain Sub-String

    Filtering for Records that Contain a Certain Sub-String

  6. Close the table
  7. When asked whether you want to save, click No
  8. In the Navigation Pane, double-click the Summary form
  9. In the Region column of the table, select North
  10. In the Sort & Filter section of the Ribbon, click Selection and click Contains North

    Filtering for Records that Contain a Certain Sub-String

    Filtering for Records that Contain a Certain Sub-String

  11. Close the form

Filtering by an Equal Sub-String

To select records that exactly match a string, in a Datasheet View, a Form View, a Report View, or a Layout View:

Alternatively, right-click the string in the column, position te mouse on Text Filters, and click Equals... In the Custom Filter dialog box, you can type the exact string or an approximate string to look for:

Practical Learning: Filtering by an Equal Sub-String

  1. In the Navigation Pane, double-click the States table
  2. Right-click anything below Region, position the mouse on Text Fields, and click Equals...
  3. To see only the states in the Pacific region, in the Customer Filter dialog box, type Pacific

    Custom Filter Dialog Box

  4. Click OK

    Filtering

  5. Right-click any cell below Region and click Clear Filter From Region
  6. Right-click any cell below State, position the mouse on Text Fields, and click Equals...
  7. In the dialog box, type *ns*

  8. Click OK

    Filtering

  9. Right-click any cell below State and click Clear Filter From State

Filtering by an Un-Equal Sub-String

To select records that have a sub-string different than the one you indicate, select a character or a sub-string in the desired column. Right-click the selected leter or sub-string. Position the mouse on Text Filters and click Does Not Equal... In the dialog box, you can type the exact or an approximate string to look for:

Filtering by a Beginning Sub-String

To select records that start with a certain letter or a sub-string of your choice, select the character or sub-string in the desired column. Right-click the selected leter or sub-string, position the mouse on Text Filters and click Begins With... In the dialog box, if you type just one character, such as c, you would get all entries that start with that character.

Here is an example:

Filter

Filtering

Filtering by a Sub-String that Does Not Begin

You can right-click a cell or text box, position the mouse on Text Filters, and click Does No Begin With.... In the dialog box, you can type one or a few characters that the values in the column should not start with. This would produce the opposite results of the Begins With option.

Filtering by a Contained Sub-String

To get a list of records that contain a certain letter or sub-stirng, right-click a cell or text box in the desired column, position the mouse on Text Filters, and click Contains... In the dialog box, you can type a string or an approximation to look for:

You can also provide a list of OR characters that the string should contain. That is, you can ask Microsoft Access to find strings that contain this character, or that character, or that character, and so on. To do this, use [] and, in [], type the characters. An example would be [dgu]

Custom Filter

This would produce all strings that include d, all strings that include g, and all strings that include u. Examples would be Arthur, Raymond, Bouba, Gabrielle, Maurice, or Orlando.

Filtering by a Sub-String that is not Contained

When filtering, you can choose to avoid records that don't contain a certain letter or sub-string. In this case, you would select Does Not Contain... when you right-click a cell or text box and position the mouse on Text Filters... In the dialog box, you can type a sub-string to look for. Any string that includes that sub-string would be excluded from the list. You can also use the square brackets to specify the characters that should not be found in some strings. For example, you can use [dgu]

Custom Filter

In this case, the result would include all strings that don't have any of the characters in the square brackets.

Filtering by an Ending Sub-String

If you want to filter for records that end with a certain letter or string, after right-clicking a cell or text box, position the mouse on Text Filters, and click Ends With... In the dialog, you can type one or a few characters that the content of the values in the column should end with:

Here is an example:

Filtering by an Ending Sub-String

Filtering by an Ending Sub-String

Filtering by a Different Sub-String

To select records that don't end with a certain letter or a sub-string, right-click a cell or text box, position the mouse on Text Filters, and click Does No End With...

Practical Learning: Ending the Lesson


Previous Copyright © 2000-2022, FunctionX, Inc. Next