View Full Version : Transferring IF Statements


petersommer
04-29-2009, 05:13 AM
Hi, firstly can I apologise for being totally clueless: I am building my first database and have jumped completely in the deep end with a reservations database!

I am trying to run a query incorporating guests billing. I have a field "Single Supplement?" as a Yes/No option on one table, and on a different table have another field "Single Supplement" listing the different single supplements for each tour. I have tried the following IF statement to no avail, and would like to know where I am going wrong:

=IF([Single Supplement?]="Yes",[Single Supplement],0)

This seems the logical way to enter it, and if the [] are cell references, it works perfectly in Excel.

DCrake
04-29-2009, 05:29 AM
Access uses the IIF as opposed to Excel IF so the syntax would be

IIF([Single Supplement?]="Yes",[Single Supplement],0)

If Yes is a text field use above. if Boolean replace Yes with True (without the quotes.

David

petersommer
04-29-2009, 05:38 AM
Thanks David,

"Yes" (Single Supplement?) is a text box with validation rule "Yes" or "No". I tried Boolean and it just got too scary for my learner brain!

and OMG.... I have been trying this for 2 days without success, getting annoyed because the resulting text box was equalling £0.00 even when somebody had "Yes" in the single supplement. I have just realised that the first tour's single supplement was £0.00 anyway, so I had it right the first time! I think I need to get some sleep!