A calculated column adds a column to the dataset that contains the results of an expression. It does not simply aggregate data in one field—it creates a new ‘field’ in the dynaset.
- Click in a blank Field cell of the QBE grid and create a calculated column by typing: ColumnName:expression. That is, you decide what name you want the column to appear as in the dynaset, type that name followed by a colon and follow the colon with the mathematical expression.
A typical example, used in creating a dynaset for inventory control, would be a calculated column: Inventory Value:[UnitsInStock]*[UnitPrice]. UnitsInStock and UnitPrice are fields in an inventory table—remember that field names used in expressions must be surrounded by square brackets. The inventory value is not stored in the table, because it doesn’t have to be. It can always be calculated, so to save space, improve performance, and discourage errors in data entry, a query is used to produce an inventory report. On that query’s dynaset, a column will appear with the correct, current inventory value.