Visual Basic Concepts
A calculated field is a field whose value is calculated as the report is generated. For example, when estimating the tax on an order, you must multiply the total price by the local tax rate. But since local tax rates differ and won't be stored in the database, the tax is generated as the report is created—a calculated field.
In this example, the extended Data Report designer is modified to include a Total field that calculates the value of Quantity * UnitPrice
. Adding a calculated field involves the following steps:
The modified data report resembles the figure below.
Note This topic is part of a series that walks you through creating a sample data report. It begins with the topic, Creating a Simple Data Report.
To add a calculated field to the data report
Select OrderID, ProductID, UnitPrice, Quantity, (Quantity * UnitPrice) As Total From [Order Details]
The SQL statement multiplies the Quantity value by the UnitPrice value to create the Total value—the calculated field. Also note that the name of the table (Order Details) contains a space, and must be enclosed by brackets.
This topic is part of a series that walks you through creating a sample data report.
To | See |
Go to the next step | Adding a Function Control to the Data Report |
Start from the beginning | Creating a Simple Data Report |