Share via


Recordset.Bookmarkable Property

Access Developer Reference

Returns a value that indicates whether a Recordset object supports bookmarks, which you can set by using the Bookmark property.

Syntax

expression.Bookmarkable

expression   A variable that represents a Recordset object.

Remarks

Check the Bookmarkable property setting of a Recordset object before you attempt to set or check the Bookmark property.

For Recordset objects based entirely on Microsoft Access database engine tables, the value of the Bookmarkable property is True, and you can use bookmarks. Other database products may not support bookmarks, however. For example, you can't use bookmarks in any Recordset object based on a linked Paradox table that has no primary key.

Example

This example uses the Bookmark and Bookmarkable properties to let the user flag a record in a Recordset and return to it later.

Visual Basic for Applications
  Sub BookmarkX()

Dim dbsNorthwind As Database Dim rstCategories As Recordset Dim strMessage As String Dim intCommand As Integer Dim varBookmark As Variant

Set dbsNorthwind = OpenDatabase("Northwind.mdb") Set rstCategories = _ dbsNorthwind.OpenRecordset("Categories", _ dbOpenSnapshot)

With rstCategories

  If .<strong class="bterm">Bookmarkable</strong> = False Then
     Debug.Print "Recordset is not Bookmarkable!"
  Else
     ' Populate Recordset.
     .MoveLast
     .MoveFirst

     Do While True
        ' Show information about current record and get 
        ' user input.
        strMessage = "Category: " &amp; !CategoryName &amp; _
           " (record " &amp; (.AbsolutePosition + 1) &amp; _
           " of " &amp; .RecordCount &amp; ")" &amp; vbCr &amp; _
           "Enter command:" &amp; vbCr &amp; _
           "[1 - next / 2 - previous /" &amp; vbCr &amp; _
           "3 - set bookmark / 4 - go to bookmark]"
        intCommand = Val(InputBox(strMessage))

        Select Case intCommand
           ' Move forward or backward, trapping for BOF 
           ' or EOF.
           Case 1
              .MoveNext
              If .EOF Then .MoveLast
           Case 2
              .MovePrevious
              If .BOF Then .MoveFirst

           ' Store the bookmark of the current record.
           Case 3
              varBookmark = .Bookmark

           ' Go to the record indicated by the stored 
           ' bookmark.
           Case 4
              If IsEmpty(varBookmark) Then
                 MsgBox "No Bookmark set!"
              Else
                 .Bookmark = varBookmark
              End If

           Case Else
              Exit Do
        End Select

     Loop

  End If

  .Close

End With

dbsNorthwind.Close

End Sub