Bookmark, Bookmarkable Properties Example (MDB)
The following example moves through the records of the Employees table from the beginning of the file to the end and stores the value of the Bookmark property for each record in an array.
' Include this statement in Declarations section of module.
Option Compare Binary
Sub RecordPositions()
Dim dbs As Database, rst As Recordset, fld As Field
Dim intI As Integer
' Declare array to hold bookmarks.
Dim varRecord() As Variant
' Return reference to current database.
Set dbs = CurrentDb
' Open table-type Recordset object.
Set rst = dbs.OpenRecordset("Employees")
' Return reference to LastName field.
Set fld = rst.Fields!LastName
' Redimension array with value of RecordCount
' property as upper bound.
ReDim varRecord(0 To rst.RecordCount - 1)
intI = 0
' Check Bookmarkable property of Recordset object.
If rst.Bookmarkable Then
Do Until rst.EOF
' Populate array with bookmarks.
varRecord(intI) = rst.Bookmark
' Increment counter.
intI = intI + 1
rst.MoveNext
Loop
End If
rst.Close
Set dbs = Nothing
End Sub