@Ruegen
just out of curiosity how come after "4wd" you didn't close the first IIf with the end ) and included the second IIf in the first?
These are nested IIF() statements.
I start with this in Notepad:
Code:
Drivetrain:IIF(test,True,False)
Then I add the conditional part:
Code:
Drivetrain:IIF([Bodystyle]="Suv",True,False)
Next add the "result if true":
Code:
Drivetrain:IIF([Bodystyle]="Suv","4WD",False)
If the is not "SUV", is if a "Truck"?? Need another IIF() statement. So.. paste in the original IIF() statement in the "result if false" clause
Code:
Drivetrain:IIF([Bodystyle]="Suv","4WD",IIF(test,True,False))
Enter the conditional part in the nested IIF():
Code:
Drivetrain:IIF([Bodystyle]="Suv","4WD",IIF([Bodystyle]="Truck",True,False))
Add the "result if true":
Code:
Drivetrain:IIF([Bodystyle]="Suv","4WD",IIF([Bodystyle]="Truck","4X4",False))
If the body style is not "SUV" and the bodystyle is not "truck", what should be returned??
Now we have:
Code:
Drivetrain:IIF([Bodystyle]="Suv","4WD",IIF([Bodystyle]="Truck","4X4","RWD"))
That is how I build nested IIF() statements for wueries
In VBA, the nested IIF() would be written:
Code:
If [Bodystyle] = "Suv" Then
Drivetrain = "4WD"
ElseIf [Bodystyle] = "Truck" Then
Drivetrain = "4X4"
Else
Drivetrain = "RWD"
End If
------------------------------
@djclntn
The expression worked in my query. It has two opening parenthesis and two closing parenthesis, so no extra parenthesis .
There is not a !, so can't be that.
There is no . (dot) in the expression
If you copied and pasted it, the expression should work..