use IIf in query criteria

  • Thread starter Thread starter John Milbury-Steen
  • Start date Start date
J

John Milbury-Steen

Why can't I use this criteria for an autonumber field of a query:

IIf(2=3, 7, *)

That is if the first condition is false, get all the records.

(I am simplifying my problem, since in the 3 terms of the IIf, the first two
actually refer to values set in a form.)

Here are some alternatives that don't work either:

IIf(2=3, 7, "*")
IIf(2=3, 7, <>0)
IIf(2=3, 7, is not null)

So, what third term can I use?

(I have also posted this in microsoft.public.access.)
 
Dear John:

In what context are you thinking that "*" means "all the records?

Are you trying to say that, when 2 = 3, then some column must be 7,
otherwise you don't care what is in that column? How about this logic
approach:

WHEN (SomeColumn = 7 OR 2 <> 3)

That should perform exactly what I think you're trying to say.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top