Calculated fields

M

MarkusJohn

Is it possible to calculate a field in a table?
I do have two date fields like from to and one fild with currency.
In the calculated field I want to have number of dates (from -to)
multiplied by the value of currency.
This result should be stored in the calculated field.

How can I do that?
 
K

Ken Snell \(MVP\)

A table won't calculate values for its fields. You use a query to do that --
and then you use the query to calculate the values for display/form/report
purposes. Storing a calculated value such as the one you describe likely is
unnecessary and will lead to data accuracy problems whenever one of the
other fields is changed -- you then must change the stored value too.
 
J

Joseph Meehan

MarkusJohn said:
Is it possible to calculate a field in a table?
I do have two date fields like from to and one fild with currency.
In the calculated field I want to have number of dates (from -to)
multiplied by the value of currency.
This result should be stored in the calculated field.

How can I do that?

You don't want to store it. You can use a query to perform the
calculation and you can base reports and forms on that query to use the
computed value. You could use an update query to store the results of the
calculation, but that is generally not recommended.

In the event that a number was wrong and someone corrects the number
they are likely to forget to correct the result. Also Access generally runs
better and faster re-computing the number than storing and retreating it.

Now if you want to keep the result of the calculation fixed even if one
of the factors in the calculation changes, then you do want to store it.
 

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