View Full Version : storing values of a calculated field


sush
02-25-2000, 04:23 AM
How can i store down values of a caluclated field.??

ie Start time
finish time

Hours/Mins = <Calculated Fields> - needs to be stored

Rate:

Line Total <[Hours/Mins]*[Rate]> - needs to be stored down?

Any ideas

Thank you

Travis
02-25-2000, 09:50 PM
Generally you don't store calculated fields. ID is that you can do the calculation anytime you need the data. But if you must store them you need to Bind the field to a table (Control Source Property). I find the easiest solution is to add code on the afterupdate of the fields that are used to get the calculation to set the field for the answer:

Private Sub Rate_AfterUpdate()
Me.[Total] = me.[Hours/Mins]*[Rate]
End sub

Private Sub Start_Time_AfterUpdate()
Me.[Hours/Mins]= DateDiff("n",[Start Time],[Finish Time])
me.[Total] = me.[Hours/Mins]*[Rate]
end sub

hope this helps