Me. refers to the form that you are currently in while writing vba code. I
gather that you haven't really gotten that far yet, but Me. will be your best
friend for a while after you do.
As far as the form/query goes, and where to put the calculation, it stands
to reason that you should put the calculation in the field being calculated.
There's really quite a bit more to it (this really should be calculated in a
report's query (the output of access) rather than a form (the input of
access)).
Anyway, to get you through in a bind, you can use an unbound control on a
for, and set it's control source to:
=Iif([tax exempt] = True, [subtotal], [subtotal] + [taxrate])
Or to create a calculated field in a query (which is how you should run a
report, but not a form), in the fieldname put:
NameOfCalculatedField: Iif([tax exempt]... etc
There is some background info you should have on either way, and
unfortunately this post would turn into a very long one if I tried to explain
everything, but hopefully you can use this to get something to work for you.
In the meantime, if you haven't seen it already, this tutorial is great for
people just starting out:
http://www.accessmvp.com/strive4peace/
hth
--
Jack Leach
www.tristatemachine.com
- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
amelia said:
I have a query set up that is called invoice total query. I added the tax
exempt field and then added it to the form. I am not sure where I am to enter
the formula you gave me. Should I enter it in the criteria for the query
field [tax exempt] or [tax] or should I enter it in the form itself? Also I
am new at this an just learning. I am not sure what your me. stands for?
I want it to produce something like this (this is what I have been trying);
(IIf [tax exempt]=true,0, [subtotal]*0)
thanks for helping!
dymondjack said:
You will need to add the checkbox into your table as a yes/no field. Then
add that to your form the same way you would with any other field.
Then, when you calculate taxes, use an expression like
Me.TaxAmount = Iif(Me.TaxExmpt = True, 0, Total * TaxPctg)
This would set the TaxAmount at 0 if the box TaxExmpt is unchecked.
Its hard to say without seeing some more detail, such as where the
calculation occurs.
--
Jack Leach
www.tristatemachine.com
- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
:
Hi I am trying to do a billing database. I have an invoice created but I
found an invoice that is tax exempt. i would like to add a check box on the
form and if the check box is checked I do not want it to calculate tax on
that invoice. What rule do I set it up to make it do this? and do I set the
rule for the check box or for the tax box that automatically calculates?