Problem with conditional criteria in query.

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
 
V

Van T. Dinh

Can't use Iif that way. Try:

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

Jason M Canady

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top