One of the rules of data normalization is
that you shouldn’t include the results of calculations in a database.
You can output the results of calculations by building those
calculations into queries, and you can display the results of the
calculations on forms and reports by making the query the foundation
for a form or report. You can also add to forms and reports controls
that contain the calculations you want. In certain cases, this can
improve performance.
The columns of a query result can hold the result of
any valid expression. This makes queries extremely powerful. For
example, you could enter the following expression:
Left([First Name],1) & "." & Left([Last Name],1) & "."
This expression would give you the first character
of the first name, followed by a period, the first character of the
last name, and another period. An even simpler expression would be this
one:
This calculation would simply multiply the Unit
Price field by the Quantity field. In both cases, Access would
automatically name the resulting expression. For example, Figure 1
shows the calculation that results from concatenating the first and
last initials. Notice in the figure that Access gives the expression a
name (often referred to as an alias). To give the expression a name, such as Initials, you must enter it as follows:
Initials:Left([First Name],1) & "." & Left([Last Name],1) & "."
The text preceding the colon is the name of the
expression—in this case, Initials. If you don’t explicitly give an
expression a name, the name defaults to Expr1.
You can enter any valid expression in the
Field row of the query design grid. Notice that Access automatically
surrounds field names that are included in an expression with square
brackets, unless the field name has spaces. If the field name includes
any spaces, you must enclose the field name in brackets; otherwise, the
query won’t run properly. This is just one of the many reasons field
and table names shouldn’t contain spaces.