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.
If you use this expression | The page displays |
---|---|
=Document.All("MSODSC").CurrentSection
.ChildSection.HTMLContainer.Children("ProductID") |
The value in the ProductID control in the section that is one group level below the current section. |
=Document.All("MSODSC").CurrentSection
.ParentSection.HTMLContainer.Children("CustomerID") |
The value in the CustomerID control in the section that is one group level above the current section. |
=Document.All("MSODSC").CurrentSection
.Parent.Parent.HTMLContainer.Children("Country") |
The value in the Country control in the section that is two group levels above the current section. |
=Document.All("MySpreadsheet").Range("A1") | The values in the range A1 in the spreadsheet control. |
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.