Microsoft Office Tutorials and References
In Depth Information
Calculating and Formatting Numbers
Where should you put your calculations?
When you want to include a calculated value
on a form or report, you can do it in one of three
ways:
βœ“ In a calculated column in a table that
contains the fields on which the calculation
is based. (This feature of Access 2013 is
described in Book II, Chapter 1.) Choose
this method if the calculation uses fields
from only one table and will be used in
more than one query, form, or report. If you
need to change the way that the
calculation works, it’s more efficient if you have to
update it in only one place.
βœ“ In a query that you use as the record
source for the form or report. Use this
method if
You plan to use the calculated value
to select the records to include in the
form or report so that you can set the
Sort row of the query to ascending or
descending for the calculated field.
You use the calculation in more than
one form or report that has this query
as its record source, or the calculation
is based on fields from more than one
table. See Book III, Chapter 2 for details
on creating calculated fields in queries.
βœ“ In a text box control on the form or report.
Use this method in all other cases.
Calculating and Formatting Numbers
To display a numeric calculation on a form or report, you can use the
arithmetic operators that we describe in Book III, Chapter 2. Access also has
numeric functions, which we describe in the same chapter.
Some sample numeric expressions (you can guess what the fields contain
from their names) are included in the following table.
Numeric Expression
Purpose
Book IV
Chapter 4
=[TaxableTotal]*[SalesTaxRate]
Sales tax on an order
=3.50 + ([ItemCount] * 2)
Shipping cost ($3.50 plus
$2 per item)
=[OrderSubtotal] + [SalesTax] +
[Shipping]
Grand total for an order
After you type an expression in the Control Source property of a text box
and switch to Form view or Print Preview to make sure that it works, you
usually want to format the number. You may not like the number of decimal
places, the use of commas, or the lack of a currency symbol in your
calculated text box, for example.
Search JabSto ::




Custom Search