You can specify a value in an expression by using a literal value, a constant, a function, or an identifier:
You can also create your own functions using Visual Basic.
Forms![Orders]![OrderDate].DefaultValue
You can combine the value of a field, control, or property with a literal string by using the & (concatenation) operator. For example, the following expression combines the literal string "[CategoryID] = " with the value of the CategoryID control on the Products form:
"[CategoryID] = " & Forms![Products]![CategoryID]
In some circumstances — for example, in a domain aggregate function such as DLookup — the value of the field, control, or property must appear in single (') or double (") quotation marks. The easiest way to accomplish this is to add a single quotation mark to the literal string, and then combine the expression with another literal string made up of a single quotation mark after the field, control, or property value, as follows:
"[CategoryID] = ' " & Forms![Products]![CategoryID] & " ' "
Existing Microsoft Access applications may use the vertical bar operators (| |) in place of an opening and closing combination of double quotation marks and & (concatenation) operators, as follows:
"[CategoryID] = '|Forms![Products]![CategoryID]|' "
However, the use of vertical bars is not recommended because they can produce unexpected results in some circumstances.
If you want an expression to produce a string that is enclosed in double quotation marks, you can either enclose the nested string in single quotation marks or three sets of double quotation marks. For example, the following expressions are equivalent:
Forms![Contacts]![City].DefaultValue = ' "Paris" '
Forms![Contacts]![City].DefaultValue = " " "Paris" " "
For more information on constants, click .
For more information on creating your own functions, click .
For more information on using identifiers in expressions, click .