Using the IIf expression

  • Thread starter Thread starter Mick Humph
  • Start date Start date
M

Mick Humph

The Iff expression returns an alternative result either
one thing or another. However I need it to return a
result from three options, namely if a field is "Null"
then return "0",or, if it is "1" then "38", or if it
is "2" then "5".

This applies to a guest house booking form. So, if the
Double room booking field is blank I want the Price field
to return £0, however if the Double room has 1 person in
it in it the price field will read £38 and if the Double
Room has 2 people in it it returns £50.

Can anyone help?
 
Dear Mick

Try this

IIF([BookingField] IS NULL,0,IIF([BookingField]=1,38,50))

This is known as a nested IF statement.
Hope this helps

Paul
 
Mick,
Use a nested IIF statement.
IIF(IsNull([YourField]),"0", IIF [YourField] = "1", "38", "50")

However, you shouldn't have set up your Price field as text... it
should be numeric.
--
HTH...
Al Campagna
Candia Computer Consulting
Candia, NH

The Iff expression returns an alternative result either
one thing or another. However I need it to return a
result from three options, namely if a field is "Null"
then return "0",or, if it is "1" then "38", or if it
is "2" then "5".

This applies to a guest house booking form. So, if the
Double room booking field is blank I want the Price field
to return £0, however if the Double room has 1 person in
it in it the price field will read £38 and if the Double
Room has 2 people in it it returns £50.

Can anyone help?
 
Back
Top