Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    North Dakota, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Run-Time Error 'Row handles must all be released' (2000)

    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
    Attached Images Attached Images

  2. #2
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run-Time Error 'Row handles must all be released' (2000)

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

    KB

    Experts

  3. #3
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    North Dakota, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run-Time Error 'Row handles must all be released' (2000)

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •