Where to enter expressions in queries and filters (MDB)

Microsoft Office Access 2003

  • The design grid of a query.

  • The design grid of the Advanced Filter/Sort window.

  • An SQL statement in a query's SQL view.

  • The Filter By Form window.

  • In queries, you can also use expressions to update values in a group of records or to create calculated fields.

    You can see how Microsoft Access evaluates query expressions by switching to a query's SQL view to display its underlying SQL statements. If your query includes linked tables, the values you specify in criteria on fields from the linked tables are case-sensitive— they must match the case of the values in the underlying table.

    Show Where to enter expressions

    In the design grid, you enter the expression in different places depending on the operation you're trying to perform. After you type an expression in the design grid and press the ENTER key, Access displays the expression using syntax it understands. If you don't include an operator with the expression, Access assumes you want the = operator. For example, if you type Denmark as the criteria in a Country field, Access displays "Denmark", and interprets the expression as Country="Denmark". If you include references to field names in the expression, the fields must be in one of the tables added to the query (unless you are using the DLookup function or a subquery). You can't drag the fields to the expression in the design grid, however. The following table shows where you can enter expressions.

    To do this Type the expression in
    Specify criteria for a select, crosstab, or action query, or for an advanced filter A Criteria cell in the design grid of a query or advanced filter.
    Create a calculated field A Field cell in the design grid of a query or advanced filter.
    Update records according to the results of the expression (update queries only) An Update To cell in the design grid of an update query.
    Specify the records you want to work with, how they are grouped, the criteria for the groupings, or how records are sorted An SQL statement in SQL view.
    Specify criteria when using Filter By Form A field in the Filter By Form window for a custom expression, or select an expression from the list in the field.