Calcualted Fields in Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I insert calculations in forms so that the fields in the related table
get updated?
For, e.g. to calculate tax in the [Tax] field as a function of the [Amount]
field and a fixed percentage say 10%, so that such a calculation is
automatically carrid out in the form and the [Tax] field in the related table
is updated.
 
The universal rule is, if it can be calculated then you should not store
it at all, just calculate it again whenever required for another
calculation, or for display or printing purposes.

Generally, you can use a control's Control Source property to bind it to
a table field, in which case the data in it gets stored in the table, or
you can use it to enter an expression, so the value in it is calculated
on the basis of other data, but not stored in a table. If you want both
a calculation and a storing, you neet to use other means for one or the
other; the most common approach is to bind the control for storing,
while a macro or some VB code is used to perform the calculation, fired
from some form event, like the Before Update / After Update / On Change
event of (an) other control(s).

HTH,
Nikos
 

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

Back
Top