Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Computer Science АС (ГСФ) / CS Work at practical classes / 9 Work with package MS Office.doc
Скачиваний:
12
Добавлен:
18.02.2016
Размер:
328.19 Кб
Скачать

To Do: Perform a Filter by Form

Filter by Form enables you to filter by multiple values rather than by only one value. You can apply a Filter by Form from both the Datasheet and Form views.

Perform these steps to use Filter by Form:

  1. Click the Filter by Form button. Access displays a single blank record. If you have recently created a filter, that previous filter's selection value appears in the single row that displays. You can erase the value and enter a different one.

  2. Scroll to the field you want to filter by or click on the empty field.

  3. Click the field's drop-down arrow to display the list. Access displays a scrolling drop-down list of every value (without duplicates) that appears in that field within the current table.

  4. Select the value by which you want to filter.

  5. Optionally, click another empty field value and select from that field's drop-down list of available values. You can select as many filtering field values as you need. Unlike the Filter by Selection, which enables you to filter only by one field value, Filter by Form enables you to filter by several fields.

  6. Click the Apply Filter button to display the filtered records.

  7. Click the Remove Filter button (before you begin filtering, this button is called the Apply Filter button) when you are ready to return to the full-record view.

By filtering on one or more fields, you can easily display only those records you want to see. The filters do not actually remove records from your tables, but they help display the data you need to see at the moment.

If you filter by a date field, Access surrounds the filtered value with pound signs (#). You often see pound signs around dates, such as #7/4/2005#; this designation enables Access to distinguish the date from a formula that might use the forward slash (/) as the divide symbol.

Note

Access can perform an Or filter, meaning that Access filters to find all records that include one or more of your selected filter field values. If you want to find all customers who live in New York or who live in Maine, for example, select New York, click the Or tab at the bottom of the Filter by Form window, and select Maine. You can continue adding Or conditions to select from one of several fields.

Note

Although Access uses an Or condition to select from one of several field values, it uses an And condition to select across fields. This means that if you select Brazil for the Country field filter and Rio for the City field filter, Access filters to find all records with both Brazil as a country and Rio for the city. If a record contains the country Brazil but Saõ Paulo for the city, such a filter would not retain that record.

Using Queries

query is really nothing more than a question you ask Access about your data. Access does not understand questions the way you generally ask them, so you must ask your question with its special query format. A query differs somewhat from a filter. A query is the request that produces a subset of data. A filter, on the other hand, just temporarily hides certain data from your Access views so that you can see only a subset of data from a table.

A query is an object, just as tables and forms are objects. Therefore, you see the Queries object page on the Database window, and you create, edit, and execute queries from this page. As with other objects, queries have names that you give them. Many queries are nothing more than named filters; however, filters go away when you are finished with them, whereas you can recall a query later by its name. If you want to reapply a filter, you must reproduce it.

Note

Although you cannot name filters, you can turn a Filter by Form request into a named query. When you enter the Filter by Form request, click the Save as Query toolbar button. Access prompts you for a query name and stores the filter as a query. Often, creating a named query from a Filter by Form is faster than generating a new query from scratch if you only want to create a simple query that filters records.

Queries are often much more advanced than filters. A query enables you to specify selected records from a table or from another query. You can create a query that selects records and fields from multiple tables. The data subset that a query generates often becomes a table-like Datasheet view from which you can report. You can build a query that extracts certain records and fields from three tables, for example, and then generate a report from those extracted records and fields.

Not only can you create a query that extracts fields and records, but also you can specify the exact order of the resulting data subset, sort the subset, and use powerful extraction criteria to select data based on very specific requirements.

Once you generate a query, you can save that query just as you save tables and reports. The saved query will contain all the instructions necessary to once again generate the data so that you do not have to build that query again.

Note

The created data subset is called a dynaset.

Соседние файлы в папке CS Work at practical classes