Force Sum Calculation of Subform (1 Viewer)

dgambale@gmail.com

Registered User.
Local time
Today, 01:11
Joined
Jul 31, 2013
Messages
19
Hello,

I have what I thought was a simple problem but seem to be stuck and could really use some help. I have simple form, looking at inventory that I am trying to calculate the sum of the quantity of a particular part that has been purchased over time. This seems to work OK. I have a calculated field in the forms footer, that I later refer to in another field.

The problem I have is I need to store this calculation. I dont wont to get into the debate about if its OK to store a calc or not, but in this case the calc looks through years of data and takes too long to recalculate on all the pages its needed.

What I am doing is when a quantity is updated in the subform, I have an AFTER UPDATE procedure make the STORED field (from main form)= CALC Field (sum calculated in subform footer).

The problem is the calc is not updated in time and the stored data field is always one change behind things. I have tried to requery the CALC in the procedure but cant seem to get the CALC to update before its stored. As soon as I click off the the Quantity field that changed, the CALC field is updated to the correct number and the Stored field is one change behind (the old CALC value).

My AFTERUPDATE procedure looks like this if the Quantity in the subform is updated:

Me.SUM.Requery (SUM is the sumation of the field in the footer of the subform)
[Forms]![items]![STORED].Value = Me.SUM.Value

Any ideas? Why is my Calculation not updating to be stored until I click off the field?

Thanks for your help.
Dean
 

Users who are viewing this thread

Top Bottom