Conditional Statement using And / or

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Conditional Statement using And / or

Post by Leesha »

Hi,
I have a query that needs to look for two criteria in order to post back the correct answer. The following sql keeps coming back stating "error". Is is even possible to do this?

Thanks,
Leesha

GreaseTrap1: IIf([contractversion]=1 And [store type]="SUP",True)

User avatar
HansV
Administrator
Posts: 78574
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Conditional Statement using And / or

Post by HansV »

You omitted the 3rd argument, it is required. This should work:

GreaseTrap1: IIf([contractversion]=1 And [store type]="SUP",True,False)

but the following has the same effect and is shorter:

GreaseTrap1: [contractversion]=1 And [store type]="SUP"
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Conditional Statement using And / or

Post by Leesha »

Perfect! Thanks!