Create an expression

Microsoft Office Access 2003

In the control where you want the result, enter a combination of identifiers, operators, and values. For example, the following expression increases the value displayed in the Freight control on the Orders form by 10 percent:

= [Forms]![Orders]![Freight] * 1.1

Notes

  • Use the ! operator in an expression if the item that follows is user-defined (an element of a collection).

  • Use the . (dot) operator if the item that follows is defined by Microsoft Access.

  • Always precede calculated control expressions by an equal sign (=).

  • Some expressions produce a true or false result. For example, if you enter this type of expression in the Condition column of a macro, Microsoft Access carries out the specified action only when the expression evaluates to true.

ShowUse the Expression Builder

  1. Start the Expression Builder.

    ShowHow?

    You can start the Expression Builder from most places where you write expressions, such as in a property sheet, a Criteria cell in the query design grid, or the Macro window.

    ShowIn a property sheet or the lower pane of the Macro window

    1. Do one of the following:

      ShowStart the Expression Builder by opening a property sheet

      • To set properties for a form or report, double-click the form selector or the report selector.

      • To set properties for the data access page, click Select Page on the Edit menu, and then click Properties on the toolbar.
      • To set properties for a table or query, click Properties on the toolbar.
      • To set properties for a section on a form or report, double-click the section selector.
      • To set properties for a section on a data access page, double-click the section bar.
      • To set properties of a query field, click the cell in the Field row, and then click Properties Button image on the toolbar.
      • To set properties of a query field list, click anywhere in the list, and then click Properties Button image on the toolbar.
      • To set properties for a control, click the control, and then click Properties Button image on the toolbar.

      ShowOpen a macro in macro Design view

      1. In the Database window, click Macros Button image under Objects.
      2. Click the name of the macro you want to open.
      3. Click the Design button on the Database window toolbar.
    2. Click the property or action argument box that will contain the expression.
    3. Click the Build button Button image next to the property or argument box.

      If a property has more than one builder associated with it, Microsoft Access displays the Choose Builder dialog box. Click Expression Builder and click OK.

    Note  If the property box or argument box where you start the Expression Builder already contains a value, that value is automatically copied into the expression box.

    ShowIn the query design grid or a macro condition

    You can start the Expression Builder in a Field or Criteria cell in query Design view or in the Condition column of the Macro window.

    1. Right-click where you want to insert the expression.
    2. On the shortcut menu, click Build.

    Note  If the cell or Condition column where you start the Expression Builder already contains a value, that value is automatically copied into the expression box.

  2. In the lower-left box of the Expression Builder, double-click or click the folder containing the element you want.
  3. In the lower-middle folder, double-click an element to paste it into the expression box, or click a category of elements.
  4. If you select a category in the lower-middle box, values display in the lower-right box. Double-click a value to paste it in the expression box.

    ShowTip

    You can also type any part of the expression directly in the expression box.

  5. Paste any operators you want in the expression by placing the insertion point in the expression box where you want the operator, and clicking one of the operator buttons that are in the middle of the builder.
  6. When your expression is complete, click OK.

Microsoft Access copies your expression to the location where you started the Expression Builder. If that location already contains a value, your new expression replaces the value or text.