Chapter 5Decision Making with VBA

You can make decisions in your VBA procedures by using conditional expressions inside the special control structures. A conditional expression is an expression that uses a relational operator (see Table 5-1), a logical operator (see Table 5-2), or a combination of both. When Visual Basic encounters a conditional expression in your program, it evaluates the expression to determine whether it is true or false.

Table 5-1: Relational operators in VBA

Operator

Description

=

Equal to

<>

Not equal to

>

Greater than

<

Less than

>=

Greater than or equal to

<=

Less than or equal to

Table 5-2: Logical operators in VBA

Operator

Description

AND

All conditions must be true before an action can be taken. ...

Get Access 2007 Programming by Example with VBA, XML, and ASP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.