If Functin within Access query

  • Thread starter Thread starter Katrina
  • Start date Start date
K

Katrina

Hi

I am new to if functins and wondered if anybody can tell me what I am doing
wrong.

I am using Access 2003 and and trying to use the if function in a query

It is one query based on another, can anyone tell me what I am doing wrong

SafetyTotal:
[S1C]+[S2C]+[S3C]+[S4C]+[S5C]+[S6C]+[S7C]+[S8C]+[S9C]+[S10C]+[S11C]+[S12C]+[S13C]+[S14C]+[S15C]+[S16C]+[S17C]+[S18C]+[S19C]+[S20C]+[S21C]

SafetyTraficLight:
IIf([SafetyTotal]<=7,"GREEN",IIf([SafetyTotal]>=8<=14,"AMBER",IIf([SafetyTotal]>=15,"RED")))

The first 2 parts of the function will work but anythng greated than 15 will
not return a red response.

Thanks everyone.
 
Katrina -

Try this:

IIf([SafetyTotal]<=7,"GREEN",IIf([SafetyTotal]>=15,"RED","AMBER"))
 
Try:

IIf([SafetyTotal]<=7,"GREEN", IIf([SafetyTotal]>=8 AND <=14,"AMBER","RED"))
 
On Tue, 1 Dec 2009 05:45:02 -0800, Katrina

Seems like a bad database design to me, with a large repeating group
SxC.
Your second IIf has a problem. It should say:
IIf(SafetyTotal>=8 AND SafetyTotal<=14,

-Tom.
Microsoft Access MVP
 
Back
Top