View Full Version : Calculation and Converting Yes/No to integer.


sft008
06-24-2001, 12:28 PM
Hello, I am a newbie to this so here goes..

I have a Boolean Yes/No Value in a report.
It print out on the report -1 for yes, 0 for no.

I want to write a line something similar to the following
(Total = (subtotal * .06) if Tax = Yes) else
(Total = subtotal if Tax = No)

Can someone help... I have been pulling my hair out. I tried to operate on the YES/NO with ABS, CInt etc... I get an error. I just need to convert YES/NO to a 1 or a 0 then I can do the rest... Thanks for any help or suggestion.

Thanks
Frank

pcs
06-24-2001, 12:42 PM
you don't need to convert it...test it
for 0 or -1

like:
If [Tax] = -1
If [Tax] = 0

hth
al

charityg
06-25-2001, 06:17 AM
Or for the control source of the field

IIf([tax]=-1, .06*[subtotal], [subtotal])

Chris RR
06-25-2001, 06:42 AM
Or use the constants True and False. Much easier to remember:

If [Tax] = True then
'calc tax
else
If [Tax] = False then
'you do not live around here...