Query Criteria

  • Thread starter Thread starter finster62
  • Start date Start date
F

finster62

The following query works:

SELECT qAllProjInfoNoDiary.ProjDescrip,
qAllProjInfoNoDiary.InspName
FROM qAllProjInfoNoDiary
WHERE (((qAllProjInfoNoDiary.Activity)<>"Closed"))

But when I change the where clause to include an IIF
Statement as follows:

WHERE (((qAllProjInfoNoDiary.Activity)=IIf([Enter Number]
=1,(qAllProjInfoNoDiary.Activity)<>"Closed","High")));

it does not work. I want to be able to used either
<>"Closed" or "High" as the criteria for the query as teh
time the query is executed. The "<>" seems to be the hold
up.

Thanks for your help!!
 
You can't enter operators as parameters. You should be able to get the results
you want by doing the following.

SELECT qAllProjInfoNoDiary.ProjDescrip,
qAllProjInfoNoDiary.InspName
FROM qAllProjInfoNoDiary
WHERE
qAllProjInfoNoDiary.Activity = IIf([Enter Number]=1,"","High")
Or ([EnterNumber]=1 AND qAllProjInfoNoDiary.Activity <> "Closed")
 
Back
Top