Private Sub cmdRequery_Click()
Dim varID as Variant 'To save the primary key
If Me.Dirty Then 'Save First
Me.Dirty = False
End If
varID = Me.ID
Me.Requery
If IsNull(varID) Then 'Must have been a new record
RunCommand acCmdRecordsGotoNew
Else
With Me.RecordsetClone
.FindFirst "ID = " & varID
If .NoMatch Then
'Do Something."
Else
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub
If your primary key is a text field, change the appropriate line to:
..FindFirst "ID = ' " & varID & " ' "
note: spaces between ' and " in the above are there for clarity & should be
removed, leaving you with:
..FindFirst "ID = '" & varID & "'"