• No results found

Filtering information by using forms

In document Microsoft Access 2013 (Page 141-145)

4

13

With 19 records displayed in the filtered table, right-click 2/1/2012 in the OrderDate

field, and then click On or After 2/1/2012 to find the six records that meet this

criterion.

TIP To display a list of the available options for date filters, right-click any cell in the OrderDate field, and then point to Date Filters.

14

Close the Orders table, clicking No when prompted to save the table layout.

+

CLEAN UP

Keep the GardenCompany04 database open for use in later exercises .

Filtering information by using forms

When you want to filter a table based on the information in several fields, the quickest

method is to use the Filter By Form command, which is available from the Advanced Filter Options list in the Sort & Filter group on the Home tab. If you choose this command when

a table is active, Access displays a filter form that resembles a datasheet. Each of the cells in the form has an associated list of all the unique values in that field in the underlying table.

In the filter form for a table, clicking the cell below a field name displays an arrow that you can use to display a list of that field’s unique values.

For each field, you can select a value from the list or enter a value. When you have finished defining the filter values, click the Apply Filter button to display only the records that con-

tain the specified values.

Using Filter By Form on a table that has only a few fields, such as the one shown in the pre-

ceding graphic, is easy. But using it on a table that has a few dozen fields can be cumber-

some, and it is often simpler to find information in the form version of the table. Using Filter

By Form on a form replaces the form with its Filter By Form version, which has a blank box

for each field.

In the filter form for a form, clicking a text box displays an arrow that you can use to display a list of that field’s unique values.

In any field, you can select filtering criteria from the field’s associated list of unique values,

or you can enter the criteria you want. If you know only part of the value you are looking for, you can use the asterisk wildcard character to represent the character or string of char-

acters you don’t know. For example, to filter out all the records with Philip, Philips, Phillip, or

Phillips in the LastName field, you can enter Phil*. Access then converts your entry to Like “Phil*”, which is the correct format, called the syntax, for this type of criterion.

SEE ALSO For information about wildcards, see the sidebar “Wildcards” following this topic.

If you want to enter alternative criteria to those you entered on the Look For page of

the filter form, use the Or page. Clicking the Or tab at the bottom of the form displays another form with blank fields so that you can enter alternatives for the same fields.

Filtering information by using forms 127

4

When you display the Or page, a second Or tab appears so that you can include a third

criterion for the same field if you want.

After you have applied the filter, you can click the buttons on the record navigation bar at the bottom of the filter form to move among the matched records in the usual way. In this exercise, you’ll filter a form by using the Filter By Form command.

SET UP

You need the GardenCompany04 database you worked with in the preceding

exercise to complete this exercise. If necessary, open the database. Then follow the steps.

1

In the Navigation pane, in the Forms group, double-click Customers to open the

Customers form in Form view.

2

On the Home tab, in the Sort & Filter group, click the Advanced Filter Options

button, and then in the list, click Filter By Form to replace the form with its filter

version.

3

Click the second text box to the right of the Name label (the box that normally displays the customer’s last name), enter s*, and then press the Enter key to replace the entry with its correct syntax, Like “s*”.

4

In the Sort & Filter group, click the Apply Filter button to toggle the filter on and display the first record that has a LastName value starting with S.

Now let’s add a second criterion that filters out only the records that have a Region

value of CA.

5

Click the Advanced Filter Options button and then click Filter By Form to redisplay

the filter form, which still contains the current filter criterion.

TIP No matter what method you use to enter filter criteria, the criteria are saved as a form property and are available until they are replaced by other criteria.

6

Click the second box to the right of the City/State/ZIP label (the box that normally displays the state or region), click the arrow that appears, and then in the list, click

CA.

Only records matching both of the criteria will be displayed.

7

Click the Apply Filter button to display the first of three records that have both a

Region value of CA and LastName values starting with S.

Next let’s enter alternative filtering criteria.

8

Switch back to the filter form, and at the bottom of the form page, click the Or tab.

9

Enter s* in the second Name box, and click WA in the list for the second City/State/ ZIP box.

10

Click the Apply Filter button to find and display records that have either a Region

value of CA and LastName values starting with S, or a Region value of WA and

Locating information that matches multiple criteria 129

4

In document Microsoft Access 2013 (Page 141-145)