Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Using named arguments in the operands of the If operator is not valid. The following example causes this error:
Dim i As Integer
Dim result As String
' Not valid.
' result = (If(i > 0, TruePart:="positive", FalsePart:="not positive")
This differs from the IIf function, which does allow named arguments, as shown in the following code:
' Valid.
IIf(i > 0, TruePart:="positive", FalsePart:="not positive")
Error ID: BC33105
To correct this error
Remove the name assignments from the operands, as shown in the following code.
result = If(i > 0, "positive", "not positive")
See Also
Concepts
Passing Arguments by Position and by Name