PRB: Comparing Bookmarks Generates Type Mismatch ErrorLast reviewed: April 16, 1996Article ID: Q129933 |
The information in this article applies to:
SYMPTOMSIf you attempt to use the Bookmark property in a compare operation with another bookmark, you receive the following error if the bookmarks are not first stored in string variables:
Run-time error 13 - Type Mismatch CAUSEThis is by design. Bookmarks in Visual Basic version 4.0 are stored in byte arrays. Arrays cannot be directly compared to each other.
RESOLUTIONBefore accessing the Bookmark property, copy the bookmark values to string variables, and make all comparisons using the string variables. The following code compares two bookmarks correctly.
Step-by-Step Example
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce ProblemUse the above example, but replace the code in the Form_Click procedure with this code:
Private Sub Form_Click() Dim Db As Database Dim Rs As Recordset Dim Cs As Recordset Set Db = DBEngine.Workspaces(0).OpenDatabase("biblio.mdb") Set Rs = Db.OpenRecordset("authors", dbOpenDynaset) Set Cs = Rs.Clone() If Rs.Bookmark = Cs.Bookmark Then 'Error 13 - Type Mismatch MsgBox "Match" else MsgBox "No Match" End If End Sub |
Additional reference words: 4.00 vb4win vb4all
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |