ADO » Recordset » CompareBookmarks

CompareEnum = recordsetobject.CompareBookmarks (Bookmark1,  Bookmark2)
The Bookmark1 is the bookmark of the first record.
The Bookmark2 is the bookmark of the second record.

Returns a CompareEnum value that compares the relative rowposition of two bookmarks in the same Recordset object.

The CompareBookmarks method returns one of the CompareEnum constants that allows you to compare the relative row positions of two records based upon the values of their bookmarks. Note that you are comparing bookmarks, not the values contained in the fields of the records.

CompareEnum Constants

Constant Value Description
adCompareEqual 1 Bookmarks are equal
adCompareGreaterThan 2 First bookmark is after second bookmark
adCompareLessThan 0 First bookmark is before second bookmark
adCompareNotComparable 4 Bookmarks cannot be compared
adCompareNotEqual 3 Bookmarks are not equal or in order

You can only make this comparison if both records are in the same Recordset object. You cannot compare bookmarks from two different Recordset objects. However, you can compare bookmarks for records in the same Recordset that have undergone sorting or filtering.

Obviously, the provider must support bookmarks or you cannot use this method.

There are two mandatory parameters. Both are variants in type.


If objRecordset.CompareBookmarks(Bookmark1, Bookmark2) = adCompareEqual Then
   MsgBox "Bookmarks Are Equal", vbOK
   MsgBox "Bookmarks Are Not Equal", vbOK
End If

See Also: