compairision of values in several cells in a form

  • Thread starter Thread starter Ian
  • Start date Start date
I

Ian

I am working on a funding project that I need to calculate
values of numbers. Each of the numbers has some
conditions that need to be met in order to do the
calculations. I was wondering if there was a way to do a
compairision of several cells in a form and put a result
in a different cell? I also want to have it be put in the
tables.

Ian
 
Allen,

Thanks for your help. If my project didn't need to show
feilds that need to be added right away then I would save
the calculations for a report.
-----Original Message-----
Hi Ian.

You can use the AfterUpdate event procedure of the text boxes in your form
to calculate the amount, and write the result to the other field. For
example:
Me.Amount = Me.PreTaxAmount + Me.TaxAmount

In general, though, you should not store a calculated amount like that in a
table. Instead, use a query that has a calculated field. You just type
something like this into the Field row of your query:
Amount: [PreTaxAmount] + [TaxAmount]
The advantage is that you never have to worry about whether you made the
updates: the calcuation in the query can never be wrong.

So, the only time you would store the calculation would be if it actaully
makes sense for the things not to add up. That would never be the case with
the above example. But if you were working on a commission that would
normally be 10%, but you want to be able to charage less in some cases, then
it would make sense to store the Commission in its own field. In that case,
a Commission that is not 10% does not represent an error in the data; it
represents an intentional decision you made for that particular record.

Hope that helps you understand why you do not normally store dependent
amounts, and how you can achieve the desired result with a query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")

Ian said:
I am working on a funding project that I need to calculate
values of numbers. Each of the numbers has some
conditions that need to be met in order to do the
calculations. I was wondering if there was a way to do a
compairision of several cells in a form and put a result
in a different cell? I also want to have it be put in the
tables.


.
 
Back
Top