Zooming into a calculated field.
In the last lesson, you learned about using expressions as criteria. You can also use expressions to create calculated fields.
A calculated field is a new field that you create in a query to indicate the results of a calculation. By default, a calculated field appears with your other fields in your query results; it can also appear in forms and reports based on the query.
You can perform numerical calculations as well as combine text (such as the FirstName and LastName fields to create a single field for a customer's name). In this lesson, you'll focus on numerical calculations.
Unlike an actual field in your database, however, the results of the calculated field are not actually stored as data. The calculation is run every time you run the query.
To create a calculated field, you need to first give it a field name, as you would any field in your database.
An example of a calculated field would be Amount in the following expression:
Amount: [Quantity] * [UnitPrice]
If you don't assign a name to the field and just type the equation, Access assigns the field name of Expr1, Expr2, and so on for each calculated field.
To enter an expression in Design view, you can:
- Type the expression directly in the design query grid.
—or—
- Type in the Zoom box by first right-clicking the cell, and then clicking Zoom on the shortcut menu.
—or—
- Use Expression Builder by right-clicking the cell, and then clicking Build on the shortcut menu.