Mutiple Condition Expression

G

GLS

Hi
I work in a hospital and have a table of patient data
including two columns - one showing the date the patient
was referred [Referral Date]and another showing how many
days the patient had waited [Length of Wait]. I want to
build an expression that will say "Action Required" when
the patient has waited more than 242 days, or "No Referral
Date" where the [Referral Date] field is null. I tried
variations on iif(Or([Length of Wait]>242,"Action
Required", [Referral Date]Is Null,"No Referral Date")"")
but just cant get it to work.

Any help much appreciated
GLS
 
W

Wayne Morgan

Which do you want to take precedence? If there is no referral date do you
want "No Referral" to show or the [Length of Wait] message to show? Is
[Length of Wait] a calculated field or something the user types in? If a
calculated field, could you just do the calculation instead of storing this
in the table?

Assuming "No Referral" has precedence:
IIf(IsNull([Referral Date]), "No Referral", IIf([Length of Wait]>242,
"Action Required"))
 
G

GLS

Thanks very much Wayne. That worked perfectly.

The Length of wait is a calculation based on todays date
minus the referreal date, therefore, when there is no
referral date the length of wait column is blank.

many thanks
GLS
-----Original Message-----
Which do you want to take precedence? If there is no referral date do you
want "No Referral" to show or the [Length of Wait] message to show? Is
[Length of Wait] a calculated field or something the user types in? If a
calculated field, could you just do the calculation instead of storing this
in the table?

Assuming "No Referral" has precedence:
IIf(IsNull([Referral Date]), "No Referral", IIf([Length of Wait]>242,
"Action Required"))

--
Wayne Morgan
Microsoft Access MVP


Hi
I work in a hospital and have a table of patient data
including two columns - one showing the date the patient
was referred [Referral Date]and another showing how many
days the patient had waited [Length of Wait]. I want to
build an expression that will say "Action Required" when
the patient has waited more than 242 days, or "No Referral
Date" where the [Referral Date] field is null. I tried
variations on iif(Or([Length of Wait]>242,"Action
Required", [Referral Date]Is Null,"No Referral Date")"")
but just cant get it to work.

Any help much appreciated
GLS


.
 
Top