Using the IIf expression

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?
 
P

Paul Falla

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
 
A

Al Camp

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?
 

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

checking for null 2
Access Building a IIF expression in Access 0
Query with IIF Expression Need Help 4
How to write function from this IIF statement 2
IIf Nz 12
Access IIF and Instr function 1
Access Access IIF and Instr function 6
IIF statement 1

Top