An operator is a sign or symbol that specifies the type of calculation to perform in an expression. Access supports arithmetic, comparison, logical, and reference operators. For example, you can use arithmetic operators such as +, -, *, and /, comparison operators to compare values, text operators to combine text, and logical operators to determine True or False values.
In this article
- Arithmetic operators
- Comparison operators
- Logical operators
- Concatenation operators
- Special operators
Arithmetic operators
Use arithmetic operators to calculate a value from two or more numbers, or to change the sign of a number from positive to negative or the reverse.
| Operator | Purpose | Example |
|---|---|---|
+ |
Adds two numbers. | [Subtotal] + [SalesTax] |
- |
Finds the difference between two numbers or indicates the negative value of a number. | [Price] - [Discount] |
* |
Multiplies two numbers. | [Quantity] * [Price] |
/ |
Divides the first number by the second number. | [Total] / [ItemCount] |
\ |
Rounds both numbers to integers, divides the first number by the second number, and then truncates the result to an integer. | [Registered] \ [Rooms] |
Mod |
Divides the first number by the second number and returns only the remainder. | [Registered] Mod [Rooms] |
^ |
Raises a number to the power of an exponent. | Number ^ Exponent |
Comparison operators
Use comparison operators to compare values and return True, False, or Null.
| Operator | Purpose | Example |
|---|---|---|
< |
Returns True if the first value is less than the second value. |
Value1 < Value2 |
<= |
Returns True if the first value is less than or equal to the second value. |
Value1 <= Value2 |
> |
Returns True if the first value is greater than the second value. |
Value1 > Value2 |
>= |
Returns True if the first value is greater than or equal to the second value. |
Value1 >= Value2 |
= |
Returns True if the first value is equal to the second value. |
Value1 = Value2 |
<> |
Returns True if the first value isn't equal to the second value. |
Value1 <> Value2 |
Note
In all cases, if either the first value or the second value is Null, the result is also Null. Because Null represents an unknown value, the result of any comparison with a Null value is also unknown.
Logical operators
Use logical operators to combine two Boolean values and return True, False, or Null. Logical operators are also called Boolean operators.
| Operator | Purpose | Example |
|---|---|---|
And |
Returns True when Expr1 and Expr2 are True. |
Expr1 And Expr2 |
Or |
Returns True when either Expr1 or Expr2 is True. |
Expr1 Or Expr2 |
Eqv |
Returns True when both Expr1 and Expr2 are True, or when both are False. |
Expr1 Eqv Expr2 |
Not |
Returns True when Expr isn't True. |
Not Expr |
Xor |
Returns True when either Expr1 or Expr2 is True, but not both. |
Expr1 Xor Expr2 |
Concatenation operators
Use concatenation operators to combine two text values into one.
| Operator | Purpose | Example |
|---|---|---|
& |
Combines two strings into one string. | string1 & string2 |
+ |
Combines two strings into one string and propagates Null values. If one value is Null, the entire expression evaluates to Null. |
string1 + string2 |
Special operators
Use special operators to return a True or False result, as described in the following table.
| Operator | Purpose | Example |
|---|---|---|
Is Null or Is Not Null |
Determines whether a value is Null or not Null. |
Field1 Is Not Null |
Like "pattern" |
Matches string values by using the wildcard operators ? and *. |
Field1 Like "instruct*" |
Between val1 And val2 |
Determines whether a numeric or date value falls within a range. | Field1 Between 1 And 10 or Field1 Between #07-01-07# And #12-31-07# |
In (val1, val2...) |
Determines whether a value is found within a set of values. | Field1 In ("red", "green", "blue") or Field1 In (1, 5, 7, 9) |