Calculations on Fields

J

Jurrasicway

Hi,

I have a field called [ExpenseClaim] which is a currency value. I need to
calculate the tax for this which is at 17.5%. I have created my report in
design mode and have tried to change the field to

=[ExpenseClaim]/1.175

This does not work. Can someone please tell me the correct protocol for
calculating field values. Do I have to do it in a query and create a report
from there?

Graeme.
 
R

Rob Parker

Well, it's difficult to give a definitive answer when the description of the
problem is simply "This does not work."

But here's a suggestion or two.

First, if you designed your report by dragging fields into it, and did not
rename the controls, it's likely that you have a textbox named ExpenseClaim
which now does not contain the field [ExpenseClaim], but the expression you
mentioned. When you view the report, this textbox will contain #Error. If
this is your problem, simply rename your textbox (eg. txtTax).

Second, your expression will not give you the tax amount, or even the total
amount including the tax. The tax amount will be
=[ExpenseClaim] * 0.175
and the total amount, including tax, will be
=[ExpenseClaim] * 1.175

Your expression will give you the untaxed component of an amount which
includes the tax amount (not what you said you were trying to calculate).

You could calculate the tax amount as a calculated field in a query, or as a
calculated control in your report - either way will work. If you do it in
the query, you will probably alias it as TaxAmount, and you can use this
field directly in your report; then you will be less likely to hit the name
conflict. But, if you consistently use a naming convention for your
controls you will avoid the problem there also. There is likely to be no
measurable difference in performance between these two methods.

HTH,

Rob
 
J

Jurrasicway

Thanks Rob. I was getting error and will rename my txtbox

Rob Parker said:
Well, it's difficult to give a definitive answer when the description of the
problem is simply "This does not work."

But here's a suggestion or two.

First, if you designed your report by dragging fields into it, and did not
rename the controls, it's likely that you have a textbox named ExpenseClaim
which now does not contain the field [ExpenseClaim], but the expression you
mentioned. When you view the report, this textbox will contain #Error. If
this is your problem, simply rename your textbox (eg. txtTax).

Second, your expression will not give you the tax amount, or even the total
amount including the tax. The tax amount will be
=[ExpenseClaim] * 0.175
and the total amount, including tax, will be
=[ExpenseClaim] * 1.175

Your expression will give you the untaxed component of an amount which
includes the tax amount (not what you said you were trying to calculate).

You could calculate the tax amount as a calculated field in a query, or as a
calculated control in your report - either way will work. If you do it in
the query, you will probably alias it as TaxAmount, and you can use this
field directly in your report; then you will be less likely to hit the name
conflict. But, if you consistently use a naming convention for your
controls you will avoid the problem there also. There is likely to be no
measurable difference in performance between these two methods.

HTH,

Rob


Jurrasicway said:
Hi,

I have a field called [ExpenseClaim] which is a currency value. I need to
calculate the tax for this which is at 17.5%. I have created my report in
design mode and have tried to change the field to

=[ExpenseClaim]/1.175

This does not work. Can someone please tell me the correct protocol for
calculating field values. Do I have to do it in a query and create a
report
from there?

Graeme.
 

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