Problem with conditional criteria in query.

  • Thread starter Thread starter Jason M Canady
  • Start date Start date
J

Jason M Canady

Hi all!

I am using the following for criteria in a query based upon a selection from
an unbound form.

IIf([Forms]![QueryTest]![Frame30]=1,<>3,3)

What I am trying to accomplish that if the Group box selected is 1 then set
the criteria for the field to Less Than or Greater Than 3 (<>3). otherwise
set the criteria to three. The "3" part works great. I cannot get the
statement to correctly evaluate <>3 however.

Any suggestions?

Thanks in advance,
Jason
 
Can't use Iif that way. Try:

....
WHERE ([Forms]![QueryTest]![Frame30]=1 AND [YourField] <> 3)
OR ([Forms]![QueryTest]![Frame30]<>1 AND [YourField] = 3)
 
That did the trick... eventually I may get the hang of what to use where in
access. In addition I had to add extra lines to accomodate the OR statement
because there was additional criteria that did not work when the or
condition was implimented. Thanks very much for your input, it helped
tremendously.

Jason


Van T. Dinh said:
Can't use Iif that way. Try:

...
WHERE ([Forms]![QueryTest]![Frame30]=1 AND [YourField] <> 3)
OR ([Forms]![QueryTest]![Frame30]<>1 AND [YourField] = 3)

--
HTH
Van T. Dinh
MVP (Access)



Jason M Canady said:
Hi all!

I am using the following for criteria in a query based upon a selection from
an unbound form.

IIf([Forms]![QueryTest]![Frame30]=1,<>3,3)

What I am trying to accomplish that if the Group box selected is 1 then set
the criteria for the field to Less Than or Greater Than 3 (<>3). otherwise
set the criteria to three. The "3" part works great. I cannot get the
statement to correctly evaluate <>3 however.

Any suggestions?

Thanks in advance,
Jason
 
Back
Top