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

Table 19.1. Access's Relational Operators

Operator

Description

>

Greater than

<

Less than

>=

Greater than or equal to

<=

Less than or equal to

<>

Not equal to

=

Equal to (not needed for simple matches)

Suppose that you want to include customer-order details in a query, but you only want to include orders with more than 19 units. Enter >19 for the Quantity field's criterion to limit the selection to those records that match the other criteria and that have order quantities of more than 19 units. The relational operators work with numbers, text values that fall within a range of words, and dates.

The Between keyword is useful when you want to extract values that fall between two other values. If you type Between #1/1/2005# And #1/31/2005# for a date criterion, for example, Access extracts only records whose date falls between 1/1/2005 and 1/31/2005 (including the days 1/1/2005 and 1/31/2005).

Access uses an implied Or when you specify multiple criteria. Instead of typing five separate Customer IDs such as 101, 102, 103,104, and 105, for example, you could enter 101 Or 102 Or 103 Or 104 Or 105. (Of course, entering Between 101 And 105 is even easier.)

Be sure to save your query when you finish with it. Click the Query Design view's Close Window button and name the query so that you are able to refer to it later. When you select the query and click Open from the Queries page of the Database window, Access runs the query, extracts the data, and displays the result in your Datasheet view.

Although Access queries are useful and not extremely complex, the screens might seem daunting at first for Access newcomers. The Access online help screens provide many examples and explanations that you might want to peruse to familiarize yourself better with database queries.

Summary

This hour showed you how to narrow your data and form subsets. Often, a table contains many more fields and records than you want to work with at any one time. Access's filter and query powers enable you to create subsets of data to make your work more manageable.

Filters provide quick subsets, but queries provide more power and flexibility. After you run a filter or query to create a subset of your data, you can make changes to the subset and modify data in the underlying tables. Although the Query Design view takes some getting used to, it enables you to specify powerful query extraction criteria so that Access searches for and finds the data with which you need to work.

Now that you can produce subsets of data, you need a way to report that data. The next hour, "Reporting with Access 2003," explores some of the reporting capabilities. The Report Wizard makes quick work of report generation from your tables and queries.

Q&A

  1. Should I use a filter or a query?

When you quickly want to see a subset of a table, use a filter. You sometimes use the subset in another way (as input to a report, for example), so creating a query that you can name and execute makes more sense.

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