Function String Extras Class

BookmarkToLong

"Bookmark To Long Integer" or "Long Integer From Bookmark" Converts the DAO "Bookmark" Property to a long integer. "Bookmark" is a Recordset Property within the Data Access Objects (DAO) that acts as the placeholder for a specific record. This is the inverse of the BookmarkFromLong function.

Signature (Visual Basic / VBA)

Public Function BookmarkToLong( _
    ByVal vBookmark As Variant _
    ) As Variant

Code Examples

    BookmarkToLong(Chr$(1) + Chr$(2) + Chr$(3) + Chr$(4) = 67305985
    BookmarkToLong(Chr$(1) + Chr$(2) + Chr$(3) + Chr$(192) = -1073544703
    Assuming
       Dim wsCur As Workspace
       Set wsCur = CreateWorkspace("Main", "Admin")
       Dim dbCur As Database
       Set dbCur = wsCur.OpenDatabase("C:\TEMP\SOMEDB.MDB")
       Dim rsCur As Recordset
       Set rsCur = dbCur.OpenRecordset("MSysObjects")
       rsCur.MoveNext
       Dim lngBookmark As Long
    for example
       lngBookmark = BookmarkToLong(rsCur.Bookmark)
    leaves
       rsCur.Bookmark = BookmarkFromLong(lngBookmark)

Parameters

Parameter Description
vBookmark String which represents the value of the "Bookmark" property for some DAO Recordset. Function returns Null if vBookmark is Null or cannot be fixed up to a String.