Or Operator

See Also3PDW9D              ExampleLANORX>Low

Used to perform a logical disjunction on two expressions.


result = expr1 Or expr2


If either or both expressions evaluate True, result is True.  The following table illustrates how result is determined:


If expr1 is     And expr2       The result
is                  is                     is


True              True                True

True              False               True

True              Null1DDW7C0                 True

False             True                True

False             False               False

False             Null                 Null

Null               True                True

Null               False               Null

Null               Null                 Null


The Or operator also performs a bit-wise comparison of identically positioned bits in two numeric expressions71RISN and sets the corresponding bit in result according to the following truth table:


If bit in          And bit in        The result
is         expr2 is           is


0                   0                      0

0                   1                      1

1                   0                      1

1                   1                      1


See Also

Arithmetic OperatorsSH0K1B

Comparison OperatorsNRJZ1K

Concatenation Operators2MYTW1K

Logical Operators1CQVUTN

Operator Precedence23082A9

Other Operators2HA580P

Or Operator Example

The example displays a message that depends on the value of variables A, B, and C, assuming that no variable is a Null.  If A = 10, B = 8, and C = 11,  the left expression is True and the right expression is False.  Because at least one comparison expression is True, the Or expression evaluates True.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.


Sub Form_Click ()

   Dim A, B, C, Msg                      ' Declare variables.

   A = 10: B = 8: C = 11                 ' Assign values.

   If A > B Or B > C Then                ' Evaluate expressions.

      Msg = "One or both comparison expressions are True."


      Msg = "Both comparison expressions are False."

   End If

   MsgBox Msg                            ' Display results.

End Sub