I want to limit the data in my database to 10000. Any records added after that, I want to delete the oldest records. Please let me know if I using the right code.
iRecords = rs.RecordCount
If iRecords > 50000 then
iDelete = iRecords - 50000
rs.MoveLast

for i = 1 to iDelete
rs.Delete adAffectCurrent
rs.MovePrevious
next
End If