Microsoft Access 2010 Bible

(Rick Simeone) #1

Part I: Access Building Blocks


180


string. The returned value is True, False, or Null. The Like and Not Like operators are
case-insensitive.

The Like operator uses the following syntax:

expression Like pattern

Like looks for the expression in the pattern; if it is present, the operation returns True. For
example:

[FirstName] Like “John” Returns True if the first name is John.
[LastName] Like “SMITH*” Returns True if the last name is Smith,
Smithson, or any other name beginning with
“Smith,” regardless of capitalization. (Wildcards
like * are discussed in the “Using wildcards”
sidebar.)
[State] Not Like “NY” Returns True for any state other than New York.

Note
If either operand in a Like operation is Null, the result is Null.


The Like and Not Like operators provides powerful and flexible tools for string comparisons.
Wildcard characters extend the flexibility of the Like operator.

Boolean (logical) operators
Boolean operators (also referred to as logical operators) are used to create multiple conditions in
expressions. Like comparison operators, these operators always return True, False, or Null.
Boolean operators include the following:

And Logical And
Or Inclusive Or
Not Logical Not

The And operator
Use the And operator to perform a logical conjunction of two expressions. The operator returns
True if both expressions are True. The general syntax of And is

Expression1 And Expression2

For example:

[tblContacts].[State] = “MA” And Returns True only if both expressions
[tblContacts].[ZipCode] = “02379” are True.
Free download pdf