[ Team LiB ] Previous Section Next Section

Performing Calculations in Reports

graphics/microsoft190_1.gif

When you create a report, you might want to include summary information or other calculations. The wizards often include built-in functions, but you can use the Expression Builder to create your own by clicking buttons for the arithmetic operators you want to use and including constant values as needed. For example, if you want to determine bonuses based on a percentage of sales, you can create an arithmetic expression to compute the results. When you generate the report, Access will perform the required calculations and display the results in the report. To display the calculations in the appropriate format, you can also use the Properties feature to specify formats for dates, currency, and other numeric data.

Choose Fields to Use in a Calculation

graphics/1_icon.jpg

In Design view, create a text box control and position it where you want the calculated field to appear, or select an existing unbound control.

graphics/2_icon.jpg

Click the Properties button on the Report Design toolbar.

graphics/3_icon.jpg

Click the Control Source property box, which specifies what data appears in a control, and then click the Expression Builder button.

graphics/4_icon.jpg

Click the equal sign (=) button.

graphics/5_icon.jpg

Enter the values and operators you want to use.

  • Click operator buttons to supply the most common operations.

  • Double-click folders in the left pane to open lists of objects you can use in your expression, including existing fields, constants, operators, and common expressions.

  • Manually type an expression.

graphics/6_icon.jpg

Click OK to insert the calculation.

graphics/7_icon.jpg

Click the Close button.

graphics/08inf16.jpg

Format Values in a Report

graphics/1_icon.jpg

In Design view, position the insertion point in the field whose format you want to change, and then click the Properties button on the Report Design toolbar.

graphics/2_icon.jpg On either the All tab or the Format tab of the property sheet, click the Format property box, click the list arrow that appears, and then click the format you want to use.

The names of the formats appear on the left side of the drop-down list, and examples of the corresponding formats appear on the right side.

graphics/3_icon.jpg

If you are formatting a number (rather than a date), and you do not want to accept the default, "Auto", click the Decimal Places property box, click the list arrow, and then click the number of decimal places you want.

graphics/4_icon.jpg

Click the Close button.

graphics/08inf17.jpg

Did You Know?

You can use a builder. Access makes it easy to change many types of settings by providing builders, or tools that simplify tasks. The Expression Builder is just one of many builders in Access. You know a builder is available for a task when you click a property box and a Build button appears.


    [ Team LiB ] Previous Section Next Section