Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

DAO 3.60: Setting Bookmark Property Moves to Wrong Row


View products that this article applies to.

This article was previously published under Q238134

↑ Back to the top


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.

↑ Back to the top


Resolution

A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next Microsoft Office service pack that contains this hotfix.

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 about support costs, visit the following Microsoft Web site:NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

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


				

↑ Back to the top


Workaround

There is no workaround for this problem.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information




Manual Installation

  1. Close or stop any applications or services that are using DAO.
  2. Download the hotfix version of Dao360.dll into a temporary directory.
  3. Locate and rename the current version of Dao360.dll, which should be in the \Program Files\Common Files\Microsoft Shared\DAO folder.
  4. Copy the hotfix version of Dao360.dll into the same location, and restart your services and applications.

Steps to Reproduce

  1. Create a Visual Basic project (Standard EXE), and add a reference to the Microsoft DAO 3.60 Object Library.
  2. In the Startup form (Form1), create a Label named lblStatus and add a Command Button.
  3. 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

				

↑ Back to the top


Keywords: KB238134, kbqfe, kbfix, kbdao360fix, kbbug, kbqfe, kbhotfixserver

↑ Back to the top

Article Info
Article ID : 238134
Revision : 8
Created on : 10/7/2005
Published on : 10/7/2005
Exists online : False
Views : 424