In a module, define a method (IIF = Inline IF):
Parameters: Condition as Boolean, TrueValue as Variant, FalseValue as Variant
If Condition Then
Here's a quick example of how you might use this in your code. Imagine you wanted to display a different confirmation message based on how many records the program was about to delete:
Dim msg as String = "Are you sure you want to delete " + IIF(n=1,"this record","these records") + "?"
If MsgBox(msg,4) = 6 Then
//…Delete Record(s) here…
If n=1, the message displayed will be:
"Are you sure you want to delete this record?"
Otherwise, it will read:
"Are you sure you want to delete these records?"