Printing recordset bookmark values

xavier.batlle

Member
Local time
Today, 05:24
Joined
Sep 1, 2023
Messages
78
Sometimes it can be interesting to print the recordset bookmark values assigned by Access. This simple function transforms the Variant value in an Hex value that can be printed.
Output example: 00-2A-25-03

Code:
Public Function BookmarkToHex(bookmarkValue As Variant)
               
        BookmarkToHex = Right("0" & Hex(AscB(VBA.MIDB(bookmarkValue, 4, 1))), 2) & "-" & _
                        Right("0" & Hex(AscB(VBA.MIDB(bookmarkValue, 3, 1))), 2) & "-" & _
                        Right("0" & Hex(AscB(VBA.MIDB(bookmarkValue, 2, 1))), 2) & "-" & _
                        Right("0" & Hex(AscB(VBA.MIDB(bookmarkValue, 1, 1))), 2)

End Function

Maybe someone will find it useful.
 
Last edited:
What do you use this for in your application?
 
What do you use this for in your application?
I don't use it in my applications but I've used it every now and then for testing purposes or for helping me to fix some bug.
Using DAO and printing bookmarks, I noticed that if you open a dbOpenTable recordset, bookmarks are consistent after closing and reopening the recordset, or if you open another Access instance and you open another dbOpenTable recordset in this other instance, bookmarks are still the same.
This doesn't happen with dbOpenSnaphot & dbOpendDynaset recordsets, as it's documented, bookmarks are reset after closing the recordsets in this case.
I know thats's not very useful, but I find it curious!
 

Users who are viewing this thread

Back
Top Bottom