Home > Sample chapters > Microsoft Office > Access

Creating Queries in Access 2010

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

  1. Open a query in Design view.

  2. Click Totals to add the Total row to the Query design grid.

  3. Click the Field cell in the column in which you want to calculate the value.

  4. Click Builder.

  5. Build the calculation in the Expression Builder.

  6. Click OK.

    httpatomoreillycomsourcemspimages613732.jpg
  7. 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.

    httpatomoreillycomsourcemspimages613734.jpg
  8. Click Run.