I have a form/subform data entry screen for a loan monitoring system. Each employee record in the main form can have one or more loan records in the subform. I have a bound textbox in the main form that shows the total amount of the line items on the subform but bound to the main forms data source of course.
On the subforms' footer, I put an unbound text box that shows the sum of the subforms line items. Then I put some code on the subforms' amount text box AfterUpdate event to update the main form's amount text box to the value of the subform's footer test box.
My problem is this: when I edit the amount column of any record in the subform, I get the the correct total on the footer text box and the AfterUpdate event fires but the main form's amount text box only gets the total of the line items based on the edited record's old value.
For example:
line item 1 amount=1
line item 2 amount=2
footer amount=3
main amount=3
when line item 2 is edited to amount=3:
footer amount=4
main amount=3 (because line item 2 old amount=2)
when line item 2 is edited to amount=4:
footer amount=5
main amount=4 (because line item 2 old value=3)
Strangely, when I put a break in the updating line of AfterUpdate and check whether the main amount is really updated and checked the value after the line has executed, the text box correctly received the new total and when I go back to the form from vba, the main amount is correct. Without the break however, the result is always like the one above.
Any ideas?
On the subforms' footer, I put an unbound text box that shows the sum of the subforms line items. Then I put some code on the subforms' amount text box AfterUpdate event to update the main form's amount text box to the value of the subform's footer test box.
My problem is this: when I edit the amount column of any record in the subform, I get the the correct total on the footer text box and the AfterUpdate event fires but the main form's amount text box only gets the total of the line items based on the edited record's old value.
For example:
line item 1 amount=1
line item 2 amount=2
footer amount=3
main amount=3
when line item 2 is edited to amount=3:
footer amount=4
main amount=3 (because line item 2 old amount=2)
when line item 2 is edited to amount=4:
footer amount=5
main amount=4 (because line item 2 old value=3)
Strangely, when I put a break in the updating line of AfterUpdate and check whether the main amount is really updated and checked the value after the line has executed, the text box correctly received the new total and when I go back to the form from vba, the main amount is correct. Without the break however, the result is always like the one above.
Any ideas?