| | Product Information Help and How-to Training Templates Support and Feedback Technical Resources Additional Resources | Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.
Refer to objects in expressions
An expression (expression: Any combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. Expressions can perform calculations, manipulate characters, or test data.) is a formula or calculation that you can use to obtain a result. Frequently, you must refer to objects in your database from an expression to return a value. For example, you might need to refer to: The value of a control or property
You refer to the value of a control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) or property in an expression (expression: Any combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. Expressions can perform calculations, manipulate characters, or test data.) by typing its identifier (identifier (expressions): An element of an expression that refers to the value of a field, control, or property. For example, Forms![Orders]![OrderID] is an identifier that refers to the value in the OrderID control on the Orders form.).
To refer to the value of a control
To refer to the value of a property
- Type the identifier for the form, report, or control to which the property applies, followed by the . (dot) operator, and the name of the property.
For example, the following identifier refers to the DefaultValue property of the OrderDate control on the Orders form:
Forms![Orders]![OrderDate].DefaultValue
Notes
A form, report, subform, or subreport
You refer to an open form or report, or the subform or subreport of an open form or report, in an expression (expression: Any combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. Expressions can perform calculations, manipulate characters, or test data.) by typing its identifier (identifier (expressions): An element of an expression that refers to the value of a field, control, or property. For example, Forms![Orders]![OrderID] is an identifier that refers to the value in the OrderID control on the Orders form.).
To refer to an open form or report
To refer to a subform or subreport
Refer to the subform or subreport control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) on the form or report that contains the subform or subreport, then use the Form or Report property of the control to refer to the actual subform or subreport.
- Type the identifier for the form or report that contains the subform or subreport, followed by the name of its subform or subreport control, the . (dot) operator, and the Form or Report property.
For example, the following identifier refers to the Orders Subform subform on the Orders form:
Forms![Orders]![Orders Subform].Form
Notes
A form or report section or report group level
Notes
A column in a list
You can refer to a column in a multiple-column list box or combo box by using the Column property of the list box or combo box control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.).
Note When you run a macro or Microsoft Visual Basic for Applications (Visual Basic for Applications (VBA): A macro-language version of Microsoft Visual Basic that is used to program Windows applications and is included with several Microsoft applications.) code containing an expression (expression: Any combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. Expressions can perform calculations, manipulate characters, or test data.) that refers to a form or report, the form or report must be open.
|