I have an Orders form with a subform showing the order lines. In the footer of the subform I have a LINES_TOTAL field that uses the Sum function to total up the cost of all the order lines. (It looks similar to the Northwind Order form.) I have a TOTAL field in the Order header form that is set to show this same total (a calculated field). I cannot get TOTAL to immediately reflect any change made to LINES_TOTAL.
The best I can manage is to change a line price and tab on twice when the two fieldds synchronise.
I can't use an event such as 'On exit' from a subform field to trigger a recalculation of TOTAL because this event would happen before LINES_TOTAL is recalculated. I would have expected that TOTAL was recalculated before the focus was passed to the next field clicked on. So I tried using the event 'On entry' in the next field then tabbed into it - and it still does not work! (I use Forms!OrderHeader!OrderLines.Form.Repaint in the On entry subroutiine.)
If I put a breakpoint in the 'On entry' sub and then step through it, TOTAL is synchronised by the above statement.
How can I keep these two synchronised?
Thanks,
Keith
The best I can manage is to change a line price and tab on twice when the two fieldds synchronise.
I can't use an event such as 'On exit' from a subform field to trigger a recalculation of TOTAL because this event would happen before LINES_TOTAL is recalculated. I would have expected that TOTAL was recalculated before the focus was passed to the next field clicked on. So I tried using the event 'On entry' in the next field then tabbed into it - and it still does not work! (I use Forms!OrderHeader!OrderLines.Form.Repaint in the On entry subroutiine.)
If I put a breakpoint in the 'On entry' sub and then step through it, TOTAL is synchronised by the above statement.
How can I keep these two synchronised?
Thanks,
Keith
Last edited: