Marking Records with a Bookmark : Recordset Bookmark « Access « VBA / Excel / Access / Word






Marking Records with a Bookmark

 
Sub TestBookmark()
   Dim rst As ADODB.Recordset
   Dim varMyBkmrk As Variant

   Set rst = New ADODB.Recordset
   rst.Open "Employees", CurrentProject.Connection, adOpenKeyset

   If Not rst.Supports(adBookmark) Then
      MsgBox "This recordset does not support bookmarks!"
      Exit Sub
   End If

   varMyBkmrk = rst.Bookmark
   Debug.Print rst.Fields(1).Value
   rst.AbsolutePosition = 7
   Debug.Print rst.Fields(1).Value

   rst.Bookmark = varMyBkmrk
   Debug.Print rst.Fields(1).Value
   rst.Close
   Set rst = Nothing
End Sub

 








Related examples in the same category

1.Does it support bookmark
2.Save Bookmark to an array
3.Using Bookmarks to Filter Records
4.declares a Variant variable named myBookmark and then assigns to it a bookmark representing the current record in an ADO recordset: