Private Sub Delete_Last()
Dim MySearch As Recordset
Set MySearch = CurrentDb.OpenRecordset("SELECT tblName.MemberCode, Count(*) AS CountRec, Max(tblName.Date) AS MaxOfDate FROM tblName GROUP BY tblName.MemberCode HAVING (Count(*))>1;")
If MySearch.RecordCount > 0 Then
MySearch.MoveFirst
Do While Not MySearch.EOF
DoCmd.RunSQL "DELETE tblName.* FROM tblName WHERE [MemberCode]='" & MySearch!MemberCode & "' AND [Date]=" & CDbl(MySearch!MaxOfDate)
MySearch.MoveNext
Loop
End If
MySearch.Close
Set MySearch = Nothing
End Sub