10-16-12, 06:55 #1Registered User
- Join Date
- Sep 2012
Unanswered: Saving Calculated Data from a Form into a Table
I have a form in which a user will type in a product, the unit price and quantity and will work out the sub total by multiplying the Unit Price by the Quantity I do this by using this formula:
However this formula doesn't save the data to the table automatically, how would I go about doing that for the data?
I also have three other fields that work out data automatically would the same apply to those?
tl;dr How to save calculated data to a table
EDIT: I've been an idiot and the answer was just staring my in the face
Instead of saving it to the table I just had it recalculate in the form
Last edited by Kisageru; 10-16-12 at 07:10.
10-16-12, 07:14 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
you store both base items and recalculate as and when required. what you have is derived data, and its a no no to store derived data, unless you have very good reasons to do so, such as performance, data integrity and so on. but in this case there is on the face of it no such justification.
why is it a no no?
well if you change one or more of the underlying base columns without changing the derived column your data will be out of sync. there isa risk that your db will glibly carry on reporting incorrect valuesI'd rather be riding on the Tiger 800 or the Norton