Calculation in the field

C

ChuaCC

Hi,

I am trying to create a form where some of the field do the calculation, and
the final answer field will be stored back to the table, but I couldn't find
the way to do it, so if anyone out there know the way, I would appreciate so
much.

Example: Field1 : Name
Field2 : Price
Field3 : Unit
Field4 : Amount

Price & Unit will be number field, and the answer for Price & Unit will be
in Amount.

Thanks in advanced.

ChuaCC a.k.a BunnyC3
 
A

AlCamp

ChuaCC,
You don't really need to "save" [Amount] in a table. As long as you're
storing Price and Unit, you can always re-caclulate the Amount in any future
report/query/form etc...
If you must save the Amount, you'll have to add an Amount field to your
table, include it in the query/table behind your form, and on the
AfterUpdate event for both Price and Unit...
[Amount] = [Price] * [Unit]
You can leave the "calculated" field you have now on your form, (rename
it CalcAmount for example) and that will always "display" the corect amount.
But it's the AfterUpdate code that keeps the [Amount] field in your table
"synched and correct"... regardless of future changes in Price or Unit.
hth
Al Camp
 

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