Chapter 6 Operators
Chapter 6 Operators
O
perators perform mathematical functions, comparison functions, or logical
operations between two numbers or numerical expressions within your program.
A simple example of an operator is the plus (+) or minus (–) sign. You will have
already come across many operators when using formulas within Access.
Operators have orders of precedence that determine the order in which the calculations
take place. Within individual categories (arithmetic, comparison, and logical), operators are
evaluated in the order of precedence, as shown in the following table from the top down.
Arithmetic Comparison Logical
Exponentiation (^) Equality (=) Not
Negation (–) Inequality () And
Multiplication and division (*, /) Less than (<) Or
Integer division (\) Greater than (>) Xor
Modulo arithmetic (Mod) Less than or equal to (<=) Eqv
Addition and subtraction (+, –) Greater than or equal to (>=) Imp
String concatenation (&) Like / Is
These orders of precedence can be changed by using parentheses within the formula.
The formulas within the innermost nested set of parentheses will always be evaluated first.
The use of parentheses to change the order of precedence can end up giving different
results than you expect, so it is important to understand how they work. Try the following
code examples in a subroutine on a module:
MsgBox ( 10 + 6 ) / 3
71