DAO 3.60: Setting Bookmark Property Moves to Wrong Row
ID: Q238134
|
The information in this article applies to:
-
Microsoft Office 2000
-
Microsoft Visual Studio 6.0 SP3
SYMPTOMS
In DAO 3.60 using the Bookmark property of a recordset to navigate to a specific record places you on the wrong record. This is likely to surface when saving a Bookmark and moving to a different record, and then moving back to the bookmarked record by setting the Bookmark property of the recordset. This can also occur when using the LastModified property after an Update. This problem is most likely to happen if the table has a very large number of records, or if the table has fewer records but a very large number of columns.
This does not occur when using DAO 3.51.
WORKAROUND
There is no workaround for this problem.
RESOLUTION
A supported fix that corrects this problem is now available from Microsoft, but
it has not been fully regression tested and should be applied only to systems
experiencing this specific problem. If you are not severely affected by this
specific problem, Microsoft recommends that you wait for the next Microsoft Office service pack
that contains this fix.
To resolve this problem immediately, contact Microsoft Product Support Services
to obtain the fix. For a complete list of Microsoft Product Support Services
phone numbers and information on support costs, please go to the following
address on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
The English version of this fix should have the following file attributes or later:
Date Time Version Size File name Platform
-------------------------------------------------------------
7/14/99 3.60.2927.4 545KB dao360.dll
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
Manual Installation
- Close or stop any applications or services that are using DAO.
- Download the hotfix version of Dao360.dll into a temporary directory.
- Locate and rename the current version of Dao360.dll, which should be in the \Program Files\Common Files\Microsoft Shared\DAO folder.
- Copy the hotfix version of Dao360.dll into the same location, and restart your services and applications.
Steps to Reproduce
- Create a Visual Basic project (Standard EXE), and add a reference to the Microsoft DAO 3.60 Object Library.
- In the Startup form (Form1), create a Label named lblStatus and add a Command Button.
- Copy the following code into the Command Button's Click() method, then run the form:
Dim dbTest As DAO.Database
Dim rsTest As DAO.Recordset
Dim strPathToMDB As String
Dim strSQL As String
Dim lngNumRecords As Long
Dim lngOriginalValue As Long
Dim lngCounter As Long
Dim varBookmark As Variant
Dim bUseTableType As Boolean
Me.Show
Me.MousePointer = vbHourglass
Me.Enabled = False
strPathToMDB = App.Path & "\BadBookmarks.MDB"
If MsgBox("Make new database?", vbYesNo) = vbYes Then
If Dir(strPathToMDB) <> "" Then Kill strPathToMDB
If DBEngine.Version = "3.6" Then
If MsgBox("Create Jet 4.0 format database?", vbYesNo) = vbYes Then
Set dbTest = DBEngine.CreateDatabase(strPathToMDB, dbLangGeneral, dbVersion40)
Else
Set dbTest = DBEngine.CreateDatabase(strPathToMDB, dbLangGeneral, dbVersion30)
End If
Else
Set dbTest = DBEngine.CreateDatabase(strPathToMDB, dbLangGeneral, dbVersion30)
End If
Else
Set dbTest = DBEngine.OpenDatabase(strPathToMDB)
End If
If MsgBox("Make new table?", vbYesNo) = vbYes Then
On Error Resume Next
strSQL = "DROP TABLE BadBookmarks"
dbTest.Execute strSQL
On Error GoTo 0
strSQL = "CREATE TABLE BadBookmarks (ID long NOT NULL"
For lngCounter = 2 To 8
strSQL = strSQL & ", Field" & lngCounter & " char(255)"
Next lngCounter
strSQL = strSQL & ", CONSTRAINT PK_BadBookmarks PRIMARY KEY (ID))"
dbTest.Execute strSQL
Else
dbTest.Execute "DELETE * FROM BadBookmarks"
End If
bUseTableType = (MsgBox("Use table-type recordset?", vbYesNo))
If bUseTableType Then
Set rsTest = dbTest.OpenRecordset("BadBookmarks", dbOpenTable)
Else
Set rsTest = dbTest.OpenRecordset("SELECT * FROM BadBookmarks")
End If
lngNumRecords = InputBox("Number of records to insert?", "Bad bookmarks", 1000)
Debug.Print "Testing DAO " & DBEngine.Version
Debug.Print "Inserting " & lngNumRecords & " records"
Debug.Print "Into a version " & dbTest.Version & " database"
Debug.Print "Using a " & IIf(bUseTableType, "table-type", "dynaset") & " recordset"
With rsTest
For lngCounter = 1 To lngNumRecords
.AddNew
.Fields(0) = lngCounter
.Fields(1) = lngCounter
.Fields(2) = lngCounter
.Fields(3) = lngCounter
.Fields(4) = lngCounter
.Fields(5) = lngCounter
.Fields(6) = lngCounter
.Fields(7) = lngCounter
.Update
If lngCounter Mod 100 = 0 Then
lblStatus.Caption = CInt((lngCounter / lngNumRecords) * 100) & _
"% complete inserting records..."
lblStatus.Refresh
End If
Next lngCounter
.Close
End With
If bUseTableType Then
Set rsTest = dbTest.OpenRecordset("BadBookmarks", dbOpenTable)
Else
Set rsTest = dbTest.OpenRecordset("SELECT * FROM BadBookmarks")
End If
With rsTest
Do While Not .EOF
lngOriginalValue = .Fields(0)
varBookmark = .Bookmark
.MoveNext
.Bookmark = varBookmark
If .Fields(0) <> lngOriginalValue Then
Debug.Print "Should be on row " & lngOriginalValue
Debug.Print vbTab & "Actually on row " & .Fields(0)
End If
If lngOriginalValue Mod 100 = 0 Then
lblStatus.Caption = CInt((lngOriginalValue / lngNumRecords) * 100) & _
"% complete checking records..."
lblStatus.Refresh
End If
.MoveNext
Loop
.Close
End With
Set rsTest = Nothing
dbTest.Close
Set dbTest = Nothing
Set DBEngine = Nothing
lblStatus.Caption = "Done!"
Me.MousePointer = vbArrow
Me.Enabled = True
Additional query words:
bookmark property dao 3.60 dao360.dll wrong record row lastmodified update
Keywords : kbDAO kbDAO360fix
Version : WINDOWS:2000,6.0 SP3
Platform : WINDOWS
Issue type : kbbug