Keep result of calculation in table

eugz

Registered User.
Local time
Today, 11:22
Joined
Aug 31, 2004
Messages
128
Hi all.
I have a TableA with 3 fields: FieldA, FieldB, Result. A Form1 based on these fields. User will put data in FieldA, FieldB and calculate in Result. Problem is how to keep result of calculation in TableA?
Thanks
 
It's usually best not to store the value. Just calc when needed.

kh
 
Thanks KH.
And does absolutly unposible to save result in table? May be by procedure or any other way?
Thanks.
 
Hum...

I would just have a pc of code in the afterupdate event for the first two controls that adds them and places the result in the the third one.

???
kh
 
eugz

It is always possible to save the result of a computation - but rarely necessary and usually wasteful of space. As a matter of good programming practice in databases, you NEVER EVER store what you can recompute on-the-fly. This is because computers have cycles to burn, but the bigger your table, the more space it takes up. OK, you say, I've got a 150 Gigabyte disk, who cares about space? But that's not the space you consume.

When you have tables and search them or otherwise process them, the bigger the table, the fewer records you can fit into the disk buffer where those records are kept during the search or processing. CPUs are SO much faster than disks that you still take an advantage if you can reduce the size of the record. Because when processing linearly, you can still save time if you can fit more than one record in a disk buffer at one time.

As to how to compute this value, put the expression in the control source of the control on the form where the values are displayed. OR build a query that includes a formula for this computed value, and build the form off the query. Then just remember to disable edits of the computed value.
 

Users who are viewing this thread

Back
Top Bottom