# Thread: IIF i could understand this

1. Registered User
Join Date
Oct 2003
Posts
233

## Unanswered: IIF i could understand this

can someone help me create a nested if than statement (VBA) out of this IIF, im having big difficulties

IIf([Int]="I",IIf([used]="1" Or [used]="2" Or [used]="3" Or [used]="A" Or [used]="B" Or [used]="C",IIf([tat]="ment","A",IIf([Qa],"33",IIf([used]="1","1","2")
)),[used]),[used]) AS PM, IIf([tat]="ment" And [PM]="a" And [used]<>"C",[used],[Pm]) AS [Fm], IIf([playing]="No","*",[FM])

Join Date
Nov 2004
Location
out on a limb
Posts
13,692
select case used
case = "1"
..insert statetments as required
case else
end select

OR

if used=1 then
..insert statetments as required
elseif used=2 then
else
endif

Join Date
Feb 2004
Location
New Zealand
Posts
1,482
I hate these I alway lose count on the (())))(())

I would write a Function to return the answer

so

Code:
```Function  Whatisit(int,used,tat,qa,playing,fm)

if int="1" then
Select case used

Case "1" Or "2" Or "3" Or "A" Or "B" Or "C"

if ucase(tat)=ucase("ment") then
Whatisit = "A"
else
if qa="33" and used = "1" then
Whatisit ="1"
else
Whatisit ="2"
End if
End Select
Else
.....
....
... me getting lost

end if

End function```
think you get the point

Then to use it in a Query

bla : Whatisit([int],[used],[tat],[qa],[playing],[fm])

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•