If yes enter zero if no enter result

W

wthoffman

I have a field "tax Exempt" which is a yes/no expression. What is the code
to have the [amount subject to tax] if the tax exempt field is a "yes" I want
the [amount subject to tax]to be Zero, if the tax exempt field is a "no"I
want the field to run its expression
enter a zero. Isn't it something like ; If taxexempt is yes enter zero
otherwise enter amount subject to tax.

Below is the expression as it works now.
AmountSubjectToTax: [salesPrice]-[TradeInAllowance]
Thank you
 
D

Douglas J. Steele

From what you've written, I'm assuming you want this in a query.

Try:

AmountSubjectToTax: IIf([tax Exempt], 0, [salesPrice]-[TradeInAllowance])
 
W

wthoffman

The default value for the taxexempt field is "no" and it is a check box. The
amount subjectToTax should run sales price-tradein and provide a figure.
When the box is checked it should enter zero. I hope I am making my self
clear. I am new to this.

Douglas J. Steele said:
From what you've written, I'm assuming you want this in a query.

Try:

AmountSubjectToTax: IIf([tax Exempt], 0, [salesPrice]-[TradeInAllowance])


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


wthoffman said:
I have a field "tax Exempt" which is a yes/no expression. What is the code
to have the [amount subject to tax] if the tax exempt field is a "yes" I
want
the [amount subject to tax]to be Zero, if the tax exempt field is a "no"I
want the field to run its expression
enter a zero. Isn't it something like ; If taxexempt is yes enter zero
otherwise enter amount subject to tax.

Below is the expression as it works now.
AmountSubjectToTax: [salesPrice]-[TradeInAllowance]
Thank you
 
W

wthoffman

I tried that and now It asks me to fill in the field "TaxExempt" when I enter
no the resulting figure is zero, even when I enter yes it gives me a zero.
The no doesnot seem to prompt the action of salesprice -tradein allowance.

Thank you,
Bill

wthoffman said:
The default value for the taxexempt field is "no" and it is a check box. The
amount subjectToTax should run sales price-tradein and provide a figure.
When the box is checked it should enter zero. I hope I am making my self
clear. I am new to this.

Douglas J. Steele said:
From what you've written, I'm assuming you want this in a query.

Try:

AmountSubjectToTax: IIf([tax Exempt], 0, [salesPrice]-[TradeInAllowance])


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


wthoffman said:
I have a field "tax Exempt" which is a yes/no expression. What is the code
to have the [amount subject to tax] if the tax exempt field is a "yes" I
want
the [amount subject to tax]to be Zero, if the tax exempt field is a "no"I
want the field to run its expression
enter a zero. Isn't it something like ; If taxexempt is yes enter zero
otherwise enter amount subject to tax.

Below is the expression as it works now.
AmountSubjectToTax: [salesPrice]-[TradeInAllowance]
Thank you
 
D

Douglas J. Steele

It's prompting you because you haven't entered the name of the TaxExempt
field properly, or else it isn't included in the table(s) being queried.

Note that in one place you called it "tax Exempt", and in another
"TaxExempt"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


wthoffman said:
I tried that and now It asks me to fill in the field "TaxExempt" when I
enter
no the resulting figure is zero, even when I enter yes it gives me a zero.
The no doesnot seem to prompt the action of salesprice -tradein allowance.

Thank you,
Bill

wthoffman said:
The default value for the taxexempt field is "no" and it is a check box.
The
amount subjectToTax should run sales price-tradein and provide a figure.
When the box is checked it should enter zero. I hope I am making my self
clear. I am new to this.

Douglas J. Steele said:
From what you've written, I'm assuming you want this in a query.

Try:

AmountSubjectToTax: IIf([tax Exempt], 0,
[salesPrice]-[TradeInAllowance])


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have a field "tax Exempt" which is a yes/no expression. What is the
code
to have the [amount subject to tax] if the tax exempt field is a
"yes" I
want
the [amount subject to tax]to be Zero, if the tax exempt field is a
"no"I
want the field to run its expression
enter a zero. Isn't it something like ; If taxexempt is yes enter
zero
otherwise enter amount subject to tax.

Below is the expression as it works now.
AmountSubjectToTax: [salesPrice]-[TradeInAllowance]
Thank you
 
W

wthoffman

I have changed the field to a text lookup and the drop down menu provides for
either a yes or No. When I run the query with your formula I get a zero for
amountSubjecttoTax. The field is taxExempt and I made the appropriate
changes. When I insert yes I should get a zero value and when I insert No I
should get the taxable amount.
Help and Thanks.

Douglas J. Steele said:
It's prompting you because you haven't entered the name of the TaxExempt
field properly, or else it isn't included in the table(s) being queried.

Note that in one place you called it "tax Exempt", and in another
"TaxExempt"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


wthoffman said:
I tried that and now It asks me to fill in the field "TaxExempt" when I
enter
no the resulting figure is zero, even when I enter yes it gives me a zero.
The no doesnot seem to prompt the action of salesprice -tradein allowance.

Thank you,
Bill

wthoffman said:
The default value for the taxexempt field is "no" and it is a check box.
The
amount subjectToTax should run sales price-tradein and provide a figure.
When the box is checked it should enter zero. I hope I am making my self
clear. I am new to this.

:

From what you've written, I'm assuming you want this in a query.

Try:

AmountSubjectToTax: IIf([tax Exempt], 0,
[salesPrice]-[TradeInAllowance])


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have a field "tax Exempt" which is a yes/no expression. What is the
code
to have the [amount subject to tax] if the tax exempt field is a
"yes" I
want
the [amount subject to tax]to be Zero, if the tax exempt field is a
"no"I
want the field to run its expression
enter a zero. Isn't it something like ; If taxexempt is yes enter
zero
otherwise enter amount subject to tax.

Below is the expression as it works now.
AmountSubjectToTax: [salesPrice]-[TradeInAllowance]
Thank you
 
D

Douglas J. Steele

Lookup fields are seldom a good idea. For one thing, you should never be
working directly with tables (or even queries): you should always be using a
form.

If taxExempt actually contains a string, you'll need to use

AmountSubjectToTax: IIf([tax Exempt] = "Yes", 0,
[salesPrice]-[TradeInAllowance])

(Actually, looking at that closer, it would probably be better to use
Nz([salesPrice], 0) - Nz(TradeInAllowance, 0) rather than strictly
[salesPrice]-[TradeInAllowance])


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


wthoffman said:
I have changed the field to a text lookup and the drop down menu provides
for
either a yes or No. When I run the query with your formula I get a zero
for
amountSubjecttoTax. The field is taxExempt and I made the appropriate
changes. When I insert yes I should get a zero value and when I insert No
I
should get the taxable amount.
Help and Thanks.

Douglas J. Steele said:
It's prompting you because you haven't entered the name of the TaxExempt
field properly, or else it isn't included in the table(s) being queried.

Note that in one place you called it "tax Exempt", and in another
"TaxExempt"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


wthoffman said:
I tried that and now It asks me to fill in the field "TaxExempt" when I
enter
no the resulting figure is zero, even when I enter yes it gives me a
zero.
The no doesnot seem to prompt the action of salesprice -tradein
allowance.

Thank you,
Bill

:

The default value for the taxexempt field is "no" and it is a check
box.
The
amount subjectToTax should run sales price-tradein and provide a
figure.
When the box is checked it should enter zero. I hope I am making my
self
clear. I am new to this.

:

From what you've written, I'm assuming you want this in a query.

Try:

AmountSubjectToTax: IIf([tax Exempt], 0,
[salesPrice]-[TradeInAllowance])


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have a field "tax Exempt" which is a yes/no expression. What is
the
code
to have the [amount subject to tax] if the tax exempt field is a
"yes" I
want
the [amount subject to tax]to be Zero, if the tax exempt field is
a
"no"I
want the field to run its expression
enter a zero. Isn't it something like ; If taxexempt is yes enter
zero
otherwise enter amount subject to tax.

Below is the expression as it works now.
AmountSubjectToTax: [salesPrice]-[TradeInAllowance]
Thank you
 
W

wthoffman

Thank you very much

Qwe said:
raza
wthoffman said:
I have a field "tax Exempt" which is a yes/no expression. What is the code
to have the [amount subject to tax] if the tax exempt field is a "yes" I
want
the [amount subject to tax]to be Zero, if the tax exempt field is a "no"I
want the field to run its expression
enter a zero. Isn't it something like ; If taxexempt is yes enter zero
otherwise enter amount subject to tax.

Below is the expression as it works now.
AmountSubjectToTax: [salesPrice]-[TradeInAllowance]
Thank you
 

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

Top