# Thread: Need help with IIf statement

1. Registered User
Join Date
Dec 2013
Posts
1

## Unanswered: Need help with IIf statement

I have used an if logic statement in Excell For quite some time now. It works great. Recently I have been working with a database and want to make a similar IIf statement in one of the fileds in a table using the calculated format. I keep getting the "The expression you entered has a function containing the wrong number of arguments". Here are the two equations. The excel one works. The access one does not. Any help would be greatly appreciated.

Excell Equation
=IF(F2="F",(IF(AND(F2="F",L2>35),"1","0")+IF(OR(M2 >=140, N2>=90),"1","0")+IF(AND(F2="F",P2<50),"1","0")+IF( R2<=150,"0","1")+IF(OR(S2>99,T2>140),"1","0")),"0" )+IF(F2="M",(IF(AND(F2="M",L2>40),"1","0")+IF(OR(M 2>=140, N2>=90),"1","0")+IF(AND(F2="M",P2<40),"1","0")+IF( R2<=150,"0","1")+IF(OR(S2>99,T2>140),"1","0")),"0" )

Access Equation
IIf([Gender]="F",(IIf([Waist]>35),"1","0")+IIf(OR([SystolicBP]>=140, [DiastolicBP]>=90),"1","0")+IIf([HDL]<50),"1","0")+IIf([Triglycerides]<=150),"0","1")+IIf(OR([FastingBloodGlucose]>99,[NonFastingBloodGlucose]>140),"1","0")),"0")+IIf([Gender]="M",(IF([Waist]>40),"1","0")+IIf(OR([SystolicBP]>=140, [DiastolicBP]>=90),"1","0")+IIf([HDL]<40),"1","0")+IIf([Triglycerides]<=150,"0","1")+IIf(OR([FastingBloodGlucose]>99,[NonFastingBloodGlucose]>140),"1","0")),"0")

2. Moderator
Join Date
Mar 2009
Posts
5,442
This looks strange (there is no OR function in Access, OR is an operator):
Code:
`IIf(OR([FastingBloodGlucose]>99,[NonFastingBloodGlucose]>140),"1","0")`
I would have expected:
Code:
`IIf(([FastingBloodGlucose]>99 OR [NonFastingBloodGlucose]>140),"1","0")`

#### Posting Permissions

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