Upload
christiana-mcgee
View
217
Download
4
Embed Size (px)
Citation preview
Click your mouse to continue
Performing Calculations—1 of 2In 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 10000.
Operators can be arithmetic operators (+ - * /) or other specialized operators.
Click your mouse to continue
Performing Calculations—2 of 2In 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.
Click your mouse to continue
Calculated FieldsTo 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.
Click your mouse to continue
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
shortcutmenu
Click your mouse to continue
Using the Zoom BoxThe Zoom box is a large text box for entering text, expressions, or other values.
type expression here
Click your mouse to continue
Using Expression BuilderExpression 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 Pastebutton
expression elements