Microsoft Office Tutorials and References
In Depth Information
Using Expression Builder
The syntax for a function usually looks something like the following:
functionName arg1 arg2 arg3 ])
functionName is the name of the function, and arg1, arg2, and arg3
represent arguments that the function accepts. The number of arguments that
a function accepts varies. Some functions take no arguments; others take
many. If a function accepts two or more arguments, the arguments must be
separated by commas.
Any argument name in square brackets is optional, meaning that you can
omit the entire argument.
A function name is always followed by parentheses — even if the function
accepts no arguments. Now(), Sqr(81), and PV(apr,TotPmts,Income)
are all examples of valid function syntax. Note as well that when typing an
argument, you can use a literal value (like the name “Smith” or the number
10), a field name, or an expression as an argument. The following three
expressions all pass literal values to their functions:
The next three expressions all pass data from fields to the function (pro-
vided that Hypot, Apr, Months, Amount, and Company are the names of
fields in the current query):
In the next examples, we use expressions as arguments:
UCase([First Name] & “ “ & [Last Name])
We know that these examples look weird, but we do have a reason for the
madness. The ability to pass literal data, field names, and/or expressions to
functions gives you a lot of flexibility.
Entering text in < and > brackets
When you use the buttons in the bottom half of Expression Builder to insert
text into your expression, that text often includes placeholders — text in
angle brackets (< >). You may see placeholders such as <expr> , <interval> ,
<npers> , or something equally bizarre in Expression Builder. Each of these
bracket things is a placeholder for an argument that you need to type.