A control can display a value that is not stored in the database but calculated as the form is displayed. This is useful when all the information needed for the calculation is stored in the database and the calculated value is not stored separately.

However, the users of the application sometimes need this value. Adding a calculated control can provide this information without violating the rules for good database design. For example, if you have a table with a field that contains the unit price of an item, and another field that contains the employee discount rate. On the form, you want to see the price that an employee has to pay. To do this, add an unbound text box and as its SourceExpr property add the following statement: "Unit Price" - ("Unit Price" * "Employee Discount Rate" / 100). This will display the price that the employee has to pay as a calculated value.

To display a calculated value

  1. Open the form in Form Designer.

  2. Select a tool that inserts an appropriate data control, for example, Check Box, Text Box, or Indicator in the Tool Box.

  3. Click twice in the design area to add the control.

  4. Open the Properties window for the control. Type the expression that you want as the SourceExpr property.

See Also