Access 2016 Intermediate

Lesson 3 – Using Operators in Queries

Access 2016

Display All Access Objects on the Navigation Pane, if necessary. Open the CSales Query query in Design view.

Steps

Practice Data

1. Select the Criteria row in the field where you want to add criteria. The insertion point appears in the Criteria row of the corresponding field . 2. Type the desired comparison operator and value. The criterion appears in the Criteria row.

Scroll as necessary and click in the Criteria row of the Credit Limit field

Type <=5000

3. Press [Enter] .

Press [Enter]

The criterion is added to the design grid.

Run the query. Notice that only records with a credit limit of $5,000 or less appear in the recordset.

Practice the Concept: Return to Design view and delete the criterion. Find all records of customers with contract dates on or after January 1, 2002, by adding >=1/1/2012 to the Criteria row of the Contract Date field and pressing [Enter] . Notice that Access inserts number symbols ( # ) around the value to indicate a date value. Run the query. Notice that only those records that match the criterion appear in the recordset.

Return to Design view and delete the criterion.

U SING AN A ND C ONDITION

Discussion

Many times, a query requires more than one condition to obtain the desired result. If you want to find all customers in PA with sales to date of over $10,000, for example, you need two conditions: State=PA and Sales to Date>10000. The records must meet both conditions to be included in the recordset. When two or more criteria must be met, you are creating an And condition. An And condition is created using the And logical operator.

Page 54

OFFICEPRO, Inc.

Made with FlippingBook - professional solution for displaying marketing and sales documents online