Use dbOpenSnapshot when opening an recordset
Sub exaRecordsets()
Dim db As Database
Dim rsTable As Recordset
Dim rsDyna As Recordset
Dim rsSnap As Recordset
Set db = CurrentDb
Set rsTable = db.OpenRecordset("Employees")
Debug.Print "TableCount: " & rsTable.RecordCount
Set rsDyna = db.OpenRecordset("Employees", dbOpenDynaset)
Debug.Print "DynaCount: " & rsDyna.RecordCount
rsDyna.MoveLast
Debug.Print "DynaCount: " & rsDyna.RecordCount
Set rsSnap = db.OpenRecordset("Employees", dbOpenSnapshot)
Debug.Print "SnapCount: " & rsSnap.RecordCount
rsSnap.MoveLast
Debug.Print "SnapCount: " & rsSnap.RecordCount
rsTable.Close
rsDyna.Close
rsSnap.Close
End Sub
Related examples in the same category