Page 18 of 23PREVNEXT

Queries II: Limit your data and calculate values

Operator Order
Exponentiation (^) 1
Negation — a leading minus sign (-) 2
Multiplication and division (*,/) 3
Integer division (\) 4
Modulus (Mod) 5
Addition and subtraction (+,-) 6
Table of common operators and their order of precedence.

If your expression has multiple arithmetic operators, Access evaluates certain operations before others. This is known as operator precedence.

You can override the order by placing parentheses around the part that you want Access to evaluate first.

If you have multiple parentheses nested inside each other, Access works from the inside out. If you have multiple operators at the same level, Access evaluates them from left to right.

Keeping in mind that Access evaluates multiplication and division before addition and subtraction, consider the following expression:

[Quantity]*([CurrentPrice]-[StartPrice])

If Quantity were 500, CurrentPrice were 40, and StartPrice were 35, the result would be 2500. Without parentheses, the result would be 19,965. That's a huge difference.

Page 18 of 23PREVNEXT