When a Microsoft Access form with a linked subform is opened, it automatically defaults to the first record in the subform. You may want to highlight another record as the current one.
Similarly, when the master record is updated (without moving to another record), the subform resets itself to the first record when you prefer to keep pointing to the same subform record.
If you have the ID of the subform row that should be the current one, use it to move to that record with the subform's RecordsetClone object and bookmark property.
Add the ResyncSubformRecord procedure to your form's module and call it like this to resync your subform record to the one you want:
Call ResyncSubformRecord(Me, "subformName", "MyField", lngValue)
Sub ResyncSubformRecord(frm As Form, strSubformName As String, strFieldName As String, lngID as Long) ' Comments: Update a subform to make a specific record the current one ' Params : frm Form object with the subform (usually Me if invoked from the parent form) ' strSubformName Name of subform with data to resync ' strFieldName Field to specify the search criteria ' lngID ID value in the field to find (usually the primary key value) Dim rst As DAO.Recordset ' Create a recordset to the subform records Set rst = frm.Controls(strSubformName).Form.RecordsetClone ' Find the first record with the specified value. ' This is designed for a numeric value. If it's a string, add quotes around it rst.FindFirst "[" & strFieldName & "] = " & lngID If Not rst.NoMatch Then ' If the value is found, resync the subform record by using the recordset's Bookmark property frm.Controls(strSubformName).Form.Bookmark = rst.Bookmark End If rst.Close End Sub
Note that you need to do this AFTER you make changes to the subform that could cause it to reset the current record. For instance, these commands would reset the current record: