You use an 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.) 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.) to refer to an object or its properties. For example, you can refer to an open form, an open report, a control on an open form or report, or any properties of the form or report.
Refer to an object by using a full identifier
The following identifier refers to the Visible property of a control:
Reports![Invoice]![ShipName].Visible
The full identifier for an object or property shows the relationship between items in the identifier. In this identifier:
It's a good idea to refer to an object or property using its full identifier. In some cases, a full identifier is required. For example, to refer to a control on a form or report that isn't the form or report with the focus, you must type its full identifier. The following expression displays the sum of the values in the Subtotal and Freight controls on the Orders form in a control on a different form:
= Forms![Orders]![Subtotal] + Forms![Orders]![Freight]
Refer to an object without a full identifier
In some circumstances, you can refer to a control or its properties without specifying a full identifier:
- If you're referring to a control on the current form or report, you don't have to specify the form or report identifier. For example, to display the sum of the values in the Subtotal and Freight controls in a different control on the same form, set the ControlSource property of the control to:
= [Subtotal] + [Freight]
- If you're referring to a control on a subform or subreport, you don't have to specify the full identifier for the form or report using the Form or Report property. For example, you can use the following identifier to refer to the Quantity control on the Orders Subform subform:
Forms![Orders]![Orders Subform]![Quantity]
The full identifier for the Quantity control would be:
Forms![Orders]![Orders Subform].Form![Quantity]
- In a macro or action argument (action argument: Additional information required by some macro actions. For example, the object affected by the action or special conditions under which the action is carried out.), you don't have to specify the identifier for the form or report from which the macro is run. For example, if you set an event property (event property: A named attribute of a control, form, report, data access page, or section you use to respond to an associated event. You can run a procedure or macro when an event occurs by setting the related event property.) on a form to the name of a macro, you can refer to controls on the form in the macro's Condition column or action arguments without specifying the form's identifier.
- In a 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.) procedure, you can use the Me keyword rather than the full identifier to refer to a control on the current form or report. For example, to assign the sum of the values in the Subtotal and Freight controls on a form to the variable OrderTotal in one of the form's event procedures, add the following statement (statement: A syntactically complete unit that expresses one specific kind of operation, declaration, or definition. A statement is usually on one line in a procedure or Declarations section, but two or more can be on a line separated by a colon (:).) to the event procedure:
OrderTotal = Me![Subtotal] + Me![Freight]
Notes