Which logical operator works best when testing a number to determine if it is within a range?

Access for Microsoft 365 Access 2021 Access 2019 Access 2016 Access 2013 Access 2010 Access 2007 More...Less

An operator is a sign or symbol that specifies the type of calculation to perform within an expression. There are mathematical, comparison, logical, and reference operators. Access supports a variety of operators, including arithmetic operators such as +, -, multiply (*), and divide (/), in addition to comparison operators for comparing values, text operators for concatenating text, and logical operators for determining true or false values. This article provides details about using these operators.

Note: Beginning in Access 2010, the Expression Builder has IntelliSense, so you can see what arguments your expression requires.

In this article

  • Arithmetic operators

  • Comparison operators

  • Logical operators

  • Concatenation operators

  • Special operators

Arithmetic operators

You use the arithmetic operators to calculate a value from two or more numbers or to change the sign of a number from positive to negative or vice versa.

Operator

Purpose

Example

+

Sum two numbers.

[Subtotal]+[SalesTax]

-

Find the difference between two numbers or indicate the negative value of a number.

[Price]-[Discount]

*

Multiply two numbers.

[Quantity]*[Price]

/

Divide the first number by the second number.

[Total]/[ItemCount]

\

Round both numbers to integers, divide the first number by the second number, and then truncate the result to an integer.

[Registered]\[Rooms]

Mod

Divide the first number by the second number, and then return only the remainder.

[Registered] Mod [Rooms]

^

Raise a number to the power of an exponent.

Number ^ Exponent

Top of Page

Comparison operators

You use the comparison operators to compare values and return a result that is 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 is not 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 then also null. Because null represents an unknown value, the result of any comparison with a null value is also unknown.

Top of Page

Logical operators

You use the logical operators to combine two Boolean values and return a true, false, or null result. Logical operators are also referred to as 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 Expr1 and Expr2 are false.

Expr1 Eqv Expr2

Not

Returns True when Expr is not true.

Not Expr

Xor

Returns True when either Expr1 is true or Expr2 is true, but not both.

Expr1 Xor Expr2

Top of Page

Concatenation operators

You use the concatenation operators to combine two text values into one.

Operator

Purpose

Example

&

Combines two strings to form one string.

string1 & string2

+

Combines two strings to form one string and propagates null values (if one value is Null, the entire expression evaluates to Null).

string1 + string2

Top of Page

Special operators

You use the 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 is found 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)

Need more help?

Which operator works best when testing a number to determine if it is outside a range?

12. The '||' logical operator works best when testing a number to determine if it is outside a range.

What logical operator has higher precedence than the other logical operators?

The logical-AND operator ( && ) has higher precedence than the logical-OR operator ( || ), so q && r is grouped as an operand. Since the logical operators guarantee evaluation of operands from left to right, q && r is evaluated before s-- .

Which operator has the highest precedence quizlet?

Arithmetic operators have a higher precedence than relational operators, and relational operator have a higher precedence than assignment operators. Despite this, it is a good idea to place parentheses around an arithmetic expression when its result will be used in a relational expression.

What is the difference between an if statement an IF ELSE statement and an IF ELSE IF statement quizlet?

. In an if/else if statement, the conditions are tested until one is found to be true. The conditionally executed statement(s) are executed and the program exits the if/else if statement. In a series of if statements, all of the if statements execute and test their conditions because they are not connected.

What is the purpose of an if statement quizlet?

"if" statement is a construct that enables a program to specify alternative paths of execution. one-way if statement executes an action if and only if the condition is true. an if-else statement decides the execution path based on whether the condition is true or false.