Microsoft Access 2010 Bible

(Rick Simeone) #1

Part I: Access Building Blocks


182


The logical And operator depends on how the two operands are evaluated by Access. Table 5.2
describes all the possible results when the operands are True or False. Notice that And returns
True only when both operands are True.

TABLE 5.2

And Operator Results


Expression1 Expression2 Expression1 And Expression2

True True True
True False False
True Null Null
False True False
False False False
False Null False
Null True Null
Null False False
Null Null Null

The Or operator
The Or operator performs a logical disjunction of two expressions. Or returns True if either condi-
tion is True. The general syntax of Or is

Expression1 Or Expression2

The following examples show how the Or operator works:

[LastName] = “Casey” Or Returns True if LastName is either
[LastName] = “Gleason” Casey or Gleason.
[TaxLocation] = “TX” Or Returns True if TaxLocation is either
[TaxLocation] = “CT” TX or CT.

The Or operator (like And) returns True or False depending on how Access evaluates its oper-
ands. Table 5.3 shows all possible combinations with two operands. Notice that Or returns False
only when both operands are False.
Free download pdf