have code below in AfterUpdate on subfrm_InvoiceLineItem . I had to make the field InvoicePayments Unbound and have this "Form_frm_Invoice.InvoicePayments = DSum("[LineTotal]", "qry_InvoiceLineItemPayments", "InvoiceID =" & Form_frm_Invoice.InvoiceIDBOX)" in OnOpen on frm_Invoice, OnCurrent on subfrm_Invoice and nested in your code in AfterUpdate on subfrm_InvoiceLineItem. the field InvoicePayments changes everytime subfrm_Invoice and subfrm_InvoiceLineItem has a change. Requerying all the time ended up with the entire form being reset.
your code is working but only when i use BreakPoints (no idea why?) in VBA. when it runs without breakpoints it ends up at the top of the records in subfrm_InvoiceLineItem. for ex..the subfrm_InvoiceLineItem consists of InvoiceLineItemID 41-46. i am editing 45 and after the code it ends up on 41.
Code:
Dim lID As Long
Application.Echo False 'turn off screen updating
lID = Me.InvoiceLineItemID 'store the current ID
Form_frm_Invoice.InvoicePayments = DSum("[LineTotal]", "qry_InvoiceLineItemPayments", "InvoiceID =" & Form_frm_Invoice.InvoiceIDBOX)
Me.InvoiceLineItemID.SetFocus
DoCmd.FindRecord lID 'get back to starting record
DoCmd.GoToRecord , , acNext ' comment this out if you want to stay where you started
Application.Echo True 'turn on screen updating