If-Then-Else, VBA statement.

      If condition_1 Then
    [ ElseIf condition_2 Then
           result_2 ]
    [ ElseIf condition_n Then
           result_n ]
      End If

   condition_n      Conditions are evaluated in the order listed.
                    Once a condition is found to be true, the corresponding code
                    will be executed and no further conditions will be evaluated.

   result_n         The code to be executed when a condition is met.

Comparison operators: Less than <, Less than or equal to <=, Greater than >, Greater than or equal to >=, Not equal <>, Equal =


Dim intVoltage as Integer
Dim strDescription as String

intVoltage = Me!txtVoltage

 If intVoltage = 110 Then
   strDescription = "Domestic"
 ElseIF intVoltage > 200
   strDescription = "European"
   strDescription = "Unknown"
 End If

MsgBox strDescription

“You see things; and you say 'Why?' But I dream things that never were; and I say 'why not?'” ~ George Bernard Shaw


Nz - Detect a NULL value.
IIf - If-Then-Else function (SQL)
Case - If Then Else
For - Loop.

© Copyright SS64.com 1999-2013
Some rights reserved