Performing Calculations—1 of 2 In addition to using queries to retrieve, update, sort, and filter data in a database, you can use a query to perform calculations. To perform a calculation, you define an expression containing a combination of database fields, constants, and operators. Allowable data types for a database field in a numeric expression are number, currency, and date/time. Constants are numbers such as 1.23 or Operators can be arithmetic operators (+ - * /) or other specialized operators.
Performing Calculations—2 of 2 In complex expressions you can enclose individual calculations in parentheses to indicate which should be performed first. In expressions without parentheses, Access calculates in the following order of precedence: multiplication and division before addition and subtraction. When operators have equal precedence, Access calculates them in order from left to right.
Calculated Fields To perform a calculation in a query, form or report, you add a calculated field to the object. A calculated field is a field that displays the results of an expression. A calculated field does not exist in the database itself. When you open an object that contains a calculated field, Access evaluates the expression defined by the calculated field and displays the resulting value.
Creating a Calculated Field in a Query To enter an expression for a calculated field in a query, you can type it directly in a Field text box in the design grid. Alternatively, you can use the shortcut menu to open the Zoom box or Expression Builder and use either one to enter the expression. type expression here or click to open Zoom box or click to open Expression Builder shortcut menu
Using the Zoom Box The Zoom box is a large text box for entering text, expressions, or other values. type expression here
Using Expression Builder Expression Builder is an Access tool that contains an expression box for entering the expression, buttons for common operators, and one or more lists of expression elements, such as table and field names. expression box common operators Paste button expression elements