nschroeder
nschroeder
- Local time
- Today, 06:54
- Joined
- Jan 8, 2007
- Messages
- 186
I have a form with a subform that includes a field called ItemCount. In the footer of the subform is a textbox, CalcCount, that calculates the sum of the ItemCount column (=SUM([ItemCount])).
In the main form under that column is another textbox called VerifyCount in which the user enters a value from another report that should match the CalcCount value. The CalcCount_AfterUpdate event compares CalcCount with VerifyCount and turns the background red if they don't match, or white if they do. This code is also called from the Form_Load event.
This all works fine, but I can't get it to work from subform events if an ItemCount value is changed. I've tried it from AfterUpdate events of both the control and the form, as well as the Current event. I've run Repaint and SetFocus methods from various places, but the CalcCount value doesn't seem to change until after all the events have completed. A msgbox displaying CalCount shows the pre-calculated value. After running the event the 2nd time, it works correctly because the calculated value has been updated. The only way it DOES work is if I put a debug stop in the event. This somehow gives the calculation time to occur. Is there an event that occurs after the footer calculations are completed, or is there some other way?
In the main form under that column is another textbox called VerifyCount in which the user enters a value from another report that should match the CalcCount value. The CalcCount_AfterUpdate event compares CalcCount with VerifyCount and turns the background red if they don't match, or white if they do. This code is also called from the Form_Load event.
This all works fine, but I can't get it to work from subform events if an ItemCount value is changed. I've tried it from AfterUpdate events of both the control and the form, as well as the Current event. I've run Repaint and SetFocus methods from various places, but the CalcCount value doesn't seem to change until after all the events have completed. A msgbox displaying CalCount shows the pre-calculated value. After running the event the 2nd time, it works correctly because the calculated value has been updated. The only way it DOES work is if I put a debug stop in the event. This somehow gives the calculation time to occur. Is there an event that occurs after the footer calculations are completed, or is there some other way?