Referring to controls on a form or a subform
The following table lists examples of expressions you can use in calculated controls on forms.
| If you use this expression |
Microsoft Access displays |
| =Forms![Orders]![OrderID] |
The value of the OrderID control on the Orders form. |
| =Forms![Orders]![Orders Subform]![OrderSubtotal] |
The value of the OrderSubtotal control on the Orders Subform on the Orders form. |
| =Forms![Orders]![Orders Subform]![ProductID].Column(2) |
The value of the third column in ProductID, a multiple-column list box on the Orders Subform on the Orders form. (0 refers to the first column, 1 refers to the second, and so on.) |
| =Forms![Orders]![Orders Subform]![Price] * 1.06 |
The product of the value of the Price control on the Orders Subform on the Orders form and 1.06 (adds 6 percent to the value of the Price control). |
| =Parent![OrderID] |
The value of the OrderID control on the main or parent form of the current subform. |
Referring to controls on a report or a subreport
The following table lists examples of expressions you can use in calculated controls on reports.
| If you use this expression |
Microsoft Access displays |
| =Reports![Invoice]![OrderID] |
The value of the OrderID control on the Invoice report. |
| =Reports![Summary]![Summary Subreport]![SalesTotal] |
The value of the SalesTotal control on the Summary Subreport on the Summary report. |
| =Parent![OrderID] |
The value of the OrderID control on the main or parent report of the current subreport. |
Referring to controls on a data access page
The following table lists examples of expressions that you can use in calculated controls on data access pages.
The following table lists examples of referring to controls on a page from a spreadsheet control.
| If you use this expression |
The page displays |
| =document.Quantity.value*document.UnitPrice.value |
The result of multiplying the value in the Quantity control by the value in the UnitPrice control. |
| =$C$1*document.UnitPrice.value |
The result of multiplying the value in the UnitPrice control by a percentage rate that is stored in spreadsheet cell C1. |
Notes
- In a calculated control, precede the expression with the equal sign (=) operator.
- When you set the Name property of a calculated control, make sure you use a unique name. Don't use the name of one of the controls you used in the expression.