If-Then-Else, VBA statement.
Syntax If condition_1 Then result_1 [ ElseIf condition_2 Then result_2 ] ... [ ElseIf condition_n Then result_n ] End If Key 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.
Less than <, Less than or equal to <=
Greater than >, Greater than or equal to >=
Not equal <>, Equal =
By default comparisons are case sensitive, to make them case insensitive, use UCase() or LCase()
If ucase(string1) = ucase(string2) then...
Dim intVoltage as Integer Dim strDescription as String intVoltage = Me!txtVoltage If intVoltage = 110 Then strDescription = "Domestic" ElseIF intVoltage > 200 strDescription = "European" Else 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.