Предполагая, что ваш элемент управления подформой в главной форме называется ctlSubForm
, это будет пример кода, который вы вызываете в подчиненной форме, например, в процедуре события AfterUpdate
:
'Store the current sub forms record/bookmark
Dim currentRecord As Variant
currentRecord = Me.Bookmark
'Requery the main form, causing the first record of subform will be selected
'(instead place your existing code here)
Me.Parent.Requery
'Set the sub forms record/bookmark to the stored record/bookmark
Me.Bookmark = currentRecord
'Set the focus to the main forms sub form control
'(this is necessary to really get the focus back to the subform)
Me.Parent.ctlSubForm.SetFocus