I have the following code in the AfterUpdate event of a subform datasheet. It is working properly, going to the next record in the list, and if on the last record in the datasheet, moving to the first record rather than saving the record and going to a new record. However, if my datasheet only has one record in it, it does not stay on that record after editing even though that record is the first and the last record. It moves to a new record. Can someone explain this please and help me resolve? Thank you!!
Code:
Dim CurDB As Database
Dim rs As recordset
Set CurDB = CurrentDb
Set rs = Me.RecordsetClone
If Me.CurrentRecord = Me.RecordsetClone.RecordCount Then
DoCmd.RunCommand acCmdRecordsGoToFirst
rs.Close
Set rs = Nothing
Exit Sub
Else
DoCmd.RunCommand acCmdRecordsGoToNext
rs.Close
Set rs = Nothing
Exit Sub
End If