Creating Queries in Access 2010
- Introducing Query Types
- Creating a Query Using the Query Wizard
- Editing a Query in Design View
- Using Criteria to Focus Query Results
- Introducing Operators
- Using Queries to Calculate Values
- Creating a Parameter Query
- Finding Duplicate Records
- Finding Unmatched Records
- Writing Query Results to a New Table
- Creating an Update Query
- Creating a Crosstab Query
- Finding the Largest and Smallest Values in a Field by Using a Query
Using Queries to Calculate Values
One popular use for database tables is to maintain sales records with fields for the order identifier, the product ordered, and the product’s price. What you can’t do in a table is perform a calculation—the fields are just designed to hold data. In a query, however, you can find totals, averages, or even the minimum or maximum value in the records found by your query.
Calculate a Value in a Query
Open a query in Design view.
Click Totals to add the Total row to the Query design grid.
Click the Field cell in the column in which you want to calculate the value.
Build the calculation in the Expression Builder.
In the Field cell with the calculation, edit the value to the left of the colon to reflect the name you want for the field when the query results are displayed as a worksheet.