Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIF statement with a Yes/No Field

I have a question about using an IIF statement with a Yes/No field. In my case, I am trying to get the statement do one thing if the Yes/No field=Yes and another if it is "No." I realize Access stores the Yes/No field as -1,0 and have attempted to formulate the statement this way.

I did make this statement:

NetDonation: IIf([PickupRequired]-1,[DonationValue]-8.75, 0, [DonationValue])

Unfortunately, this statement does not differentiate between the PickupRequired field being "No" or "Yes" and it subtracts 8.75 from all values regardless if the PickupRequired field = No.

like image 222
user3185924 Avatar asked Jan 11 '14 20:01

user3185924


1 Answers

IIf() will recognize Yes/No fields as True or False without your having to specify a numeric value, so the following will work just fine

IIf([PickupRequired], "The value is Yes", "The value is No")

In your particular case I suspect that you want

NetDonation: [DonationValue] - IIf([PickupRequired], 8.75, 0)
like image 108
Gord Thompson Avatar answered Nov 26 '22 15:11

Gord Thompson