• Run-Time Error ‘Row handles must all be released’ (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Run-Time Error ‘Row handles must all be released’ (2000)

    Author
    Topic
    #382849

    I’m getting a run-time error and I’m not sure what’s causing it. See the picture for the error and the form it’s erring on.

    This is the code behide the left arrow (removes approved names from list).
    ====================================================================
    Private Sub cmdRemoveEmployee_Click()
    Dim rs As New ADODB.Recordset
    Dim ListCol0 As String
    Dim ListCol1 As String
    Dim frm As Form
    Dim ctl As Control
    Dim varitm As Variant
    Dim intI As Integer

    Set frm = Forms!subfrmApprovedInstallations
    Set ctl = frm!lstApprovedEmployees

    rs.Open “tblApprovedInstallations2”, CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTableDirect

    With rs
    For Each varitm In ctl.ItemsSelected
    For intI = 0 To ctl.ColumnCount – 3
    ListCol0 = Me.lstApprovedEmployees.Column(0)
    ListCol1 = Me.lstApprovedEmployees.Column(1)
    .Index = “PrimaryKey” ‘THE ERROR APPEARS ON THIS LINE
    .Seek Array(ListCol1, ListCol0), adSeekFirstEQ
    If (Not .BOF And Not .EOF) Then
    .Delete
    End If
    Next intI
    Next varitm
    .Close
    End With

    Set rs = Nothing

    Me.lstApprovedEmployees.Requery
    Me.lstAvailableEmployees.Requery

    End Sub
    =============================================================================

    The error appears on line “.Index = “PrimaryKey””. On the tblApprovedInstallations2 table I have an index set called PrimaryKey that uses the EmployeeNumber field and the SoftwareProductID field. The error appears when I have more than one item highlighted in the Approved listbox and click the button. I don’t get any error when I do one by one.

    Any ideas?

    Thanks sarah

    Viewing 0 reply threads
    Author
    Replies
    • #650452

      Here’s a couple of links that hopefully will help.

      KB

      Experts

      • #650465

        Thanks Paul.

        Both sites were helpful and I added a Requery before the .Index = “PrimaryKey” line and now the error doesn’t appear and the form works like it should.
        This is a portion of the modified code:
        =========================
        With rs
        For Each varitm In ctl.ItemsSelected
        For intI = 0 To ctl.ColumnCount – 3
        ListCol0 = Me.lstApprovedEmployees.Column(0)
        ListCol1 = Me.lstApprovedEmployees.Column(1)
        .Requery ‘THIS WAS ADDED
        .Index = “PrimaryKey”
        .Seek Array(ListCol1, ListCol0), adSeekFirstEQ
        If (Not .BOF And Not .EOF) Then
        .Delete
        End If
        Next intI
        Next varitm
        .Close
        End With
        ===================================

        Thanks for your help!
        Sarah

    Viewing 0 reply threads
    Reply To: Run-Time Error ‘Row handles must all be released’ (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: