You can specify more than one conditioncriteriain a query; this is called compound criteria. Compound criteria enable you to create queries that are quite specific. Two types of compound criteria used in queries are AND and OR, which are logical operators. Logical operators allow you to enter criteria for the same field or different fields.
Compound criteria that create an AND condition will return those records in the query result that meet both parts of the specified criteria.
In this activity, you will specify the criteria in the query to display pledges obtained by the Culinary Arts Club for amounts greater than $20.
With Queries selected on the Objects bar, double-click Create query in Design view. Add the Pledges table to the table area, and then Close the Show Table dialog box.
Expand the table area and the field list. From the Pledges field list, add the following fields to the design grid: Club Affiliation, Pledge Amount, and Date Collected.
In the Criteria row, under Club Affiliation, type Culinary Arts Club and then press . In the Criteria row under Pledge Amount, type >20 and then compare your screen with Figure 2.32.
Click the Run button .
Click the Close Window button . Click Yes to save changes to the query, and in the Save As dialog box using your own name, type 2A AND Query Firstname Lastname as the query name. Click OK or press .
If you have been instructed to submit your 2A_Club_Fundraiser database file electronically, skip this step. Otherwise, in the Database window, click once to select your 2A AND Query and then, on the Database toolbar, click the Print button .
Use the OR condition to specify multiple criteria for a single field, or multiple criteria on different fields when you want the records that meet either condition to display in the results.
Double-click Create query in Design view. Add the Pledges table to the table area and expand the table area and the field list. Add the following four fields to the design grid: Student#, Club Affiliation, Pledge Amount, and Date Collected.
In the Criteria row, under Club Affiliation, type Student Government Association
In the design grid, locate the or row. In the or row, under Club Affiliation, type International Business Student Association and then press . Widen the column so that you can check your typing. Compare your screen with Figure 2.33.
Another Way: To Use the OR Compound Operator
You can type multiple criteria for the same field on the Criteria row. For example, type Student Government Association or International Business Student Association. Both organizations will display in the results.
Run the query.
Return to the Design view . Under Club Affiliation, in the or row, select the existing value, and then press . In the or row under Pledge Amount type >30 and then compare your screen with Figure 2.34.
Run the query to display the 10 records that match either condition, and then compare your screen with Figure 2.35.
Close the Query window and save the query as 2A OR Query Firstname Lastname as the query name. Click OK.
If you have been instructed to submit your work electronically, skip this step. Otherwise, in the Database window, select your 2A OR Query and then Print the query results. Leave the database open for the next activity.
GO! with Microsoft Office 2003 Brief (2nd Edition)