HELP WITH EXPRESSIONS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on a database that assigns a risk rating to an activity. I want
the rating to convert into an insurance coverage requirement. The following
is my expression. What am I doing wrong?

=IIf([AUTOMOBILE LIABILITY RISK RATING NUMERIC]<=3,500000) Or
IIf([AUTOMOBILE LIABILITY RISK RATING NUMERIC]=4<6,100000000) Or
IIf([AUTOMOBILE LIABILITY RISK RATING NUMERIC]=6<8,200000000) Or
IIf([AUTOMOBILE LIABILITY RISK RATING NUMERIC]=8<=10,500000000)
 
you must net the extra iif's within the first
eg
iif(x>y, iif(x=2,3,iif(x=1,4,5)),4)
is tricky u just have to concentrate when typing and make sure u dont get
any interuptions!!!!!!!!!!!!!!!!
 
nesting IIf() functions is one solution, see Patrick's post elsewhere in
this thread. (as he noted, nested IIf() functions can be very complex; you
need a clear understanding of the mechanics of the function, and a clear
understanding of exactly what return you need, because the nesting
configuration varies according to the desired outcome.) an possible
alternative to simple nesting of IIf() functions, is to use the Switch
function. again, you need to understand both the mechanics of the function,
and what return you need. however, your basic equations don't make sense to
me.

[AUTOMOBILE LIABILITY RISK RATING NUMERIC]<=3
equates to [Auto...] is less than or equal to 3.
that's a standard comparison equation, no problem.

[AUTOMOBILE LIABILITY RISK RATING NUMERIC]=4<6
equates to [Auto...] equals 4 is less than 6.
that's not a valid equation AFAIK; i don't think that Access will be able to
resolve it in a consistent, meaningful way, if at all.

[AUTOMOBILE LIABILITY RISK RATING NUMERIC]=6<8,200000000
equates to [Auto...] equals 6 is less than 8.
ditto above comments.
[AUTOMOBILE LIABILITY RISK RATING NUMERIC]=8<=10,500000000
equates to [Auto...] equals 8 is less than or equal to 10.
ditto above comments.

can you explain in words what comparison you intend to make? then we can
help you convert it to a valid expression.

hth
 
I think I would use a custom VBA function to do this. However, you can use
the SWITCH function to do this

=Switch([AUTOMOBILE LIABILITY RISK RATING NUMERIC]<=3,500000,
[AUTOMOBILE LIABILITY RISK RATING NUMERIC] >3
AND [AUTOMOBILE LIABILITY RISK RATING NUMERIC] <=5,100000000,
[AUTOMOBILE LIABILITY RISK RATING NUMERIC]>5
AND [AUTOMOBILE LIABILITY RISK RATING NUMERIC] <=7,200000000,
[AUTOMOBILE LIABILITY RISK RATING NUMERIC]>7
AND [AUTOMOBILE LIABILITY RISK RATING NUMERIC] <=10,500000000)

You can do this with nested IIF statements, but it is much harder for me to
understand and modify.
 
Back
Top