If-Then-Else, VBA statement.
Syntax Select Case test_expression Case condition_1 result_1 Case condition_2 result_2 ... Case condition_n result_n [ Case Else result_else ] End Select Key test_expression An expression returning a string or numeric value. This value will be compared to the list of conditions. 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 =
Range comparison can also be done: 1 To 10 or 500 To 600
or the comparison may be a comma separated list of items: 2,4,6,8,10 or "Jan", "Feb", "Mar"
Dim intVoltage as Integer Dim strDescription as String intVoltage = Me.txtVoltage Select Case intVoltage Case 110 strDescription = "Domestic" Case 220,240 strDescription = "European" Case 600 strDescription = "Industrial" Case Else strDescription = "Unknown" End Select 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.