If Functin within Access query

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.
 
D

Daryl S

Katrina -

Try this:

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

Arvin Meyer [MVP]

Try:

IIf([SafetyTotal]<=7,"GREEN", IIf([SafetyTotal]>=8 AND <=14,"AMBER","RED"))
 
T

Tom van Stiphout

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
 

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

Access Query problem 1
Aggregate Function Error 0
Query statement 13
DateAdd Function Return Range of Records? 1
Query Question 1
macro to run parameterised function 1
Query to Complex with Criteria 1
Microsoft Functions 1

Top