Using OR in a query

  • Thread starter Thread starter deeds
  • Start date Start date
D

deeds

I have a criteria in a query field

Expr1: IIf([2007 - CYM] Is Null,0,[2008 - CYM])

This works fine now I want to also add when it is <0,0

How do I add something like OR so I can make anything that is NULL or <0, 0.

Thanks.
 
Expr1: IIf([2007 - CYM] Is Null OR [2007 - CYM] <0 ,0,[2008 - CYM])

or use this alternative
Expr1: IIf(Nz([2007 - CYM],0) <= 0,0,[2008 - CYM])

Or try this variation

IIF([2007 - CYM] >0,[2007 - CYM],0)


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 
Expr1: IIf([2007 - CYM] Is Null OR [2007 - CYM] <0,0,[2008 - CYM])

For nulls you can use the Nz function -- Nz([2007 - CYM], 0) -- to achieve
your orignal IIF.
 
Thanks! Works great!

John Spencer said:
Expr1: IIf([2007 - CYM] Is Null OR [2007 - CYM] <0 ,0,[2008 - CYM])

or use this alternative
Expr1: IIf(Nz([2007 - CYM],0) <= 0,0,[2008 - CYM])

Or try this variation

IIF([2007 - CYM] >0,[2007 - CYM],0)


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
I have a criteria in a query field

Expr1: IIf([2007 - CYM] Is Null,0,[2008 - CYM])

This works fine now I want to also add when it is <0,0

How do I add something like OR so I can make anything that is NULL or <0, 0.

Thanks.
 
Thanks! Works great!

KARL DEWEY said:
Expr1: IIf([2007 - CYM] Is Null OR [2007 - CYM] <0,0,[2008 - CYM])

For nulls you can use the Nz function -- Nz([2007 - CYM], 0) -- to achieve
your orignal IIF.
--
KARL DEWEY
Build a little - Test a little


deeds said:
I have a criteria in a query field

Expr1: IIf([2007 - CYM] Is Null,0,[2008 - CYM])

This works fine now I want to also add when it is <0,0

How do I add something like OR so I can make anything that is NULL or <0, 0.

Thanks.
 
Back
Top