? 3014 Can't open any more tables - Click header to sort by column fails 
Author Message
 ? 3014 Can't open any more tables - Click header to sort by column fails

    I have a DBgrid set  up to sort by a column.  But after ~20
click-header-sort column events, I get '3014  Can't open any more tables'.
Tried closing the old recordsets that were being replace but no effect.

TBH
Jeff

Private Sub cmdSort_Click()
    On Error GoTo SortErr

    Dim recRecordset1 As Recordset, recRecordset2 As Recordset
    Dim SortStr As String

    If data1.RecordsetType = vbRSTypeTable Then
        Beep
        MsgBox "You Cannot Sort a Table Recordset!", 48
        Exit Sub
    End If

    Set recRecordset1 = data1.Recordset.Clone                         'copy
the recordset

    If Len(msSortCol) = 0 Then
        SortStr = InputBox("Enter Sort Column:")
        If Len(SortStr) = 0 Then Exit Sub
    Else
        SortStr = msSortCol
    End If

    Screen.MousePointer = vbHourglass
    recRecordset1.Sort = SortStr

    'establish the Sort
    Set recRecordset2 = recRecordset1.OpenRecordset(recRecordset1.Type)
    data1.Recordset.Close
    Set data1.Recordset = recRecordset2
    recRecordset1.Close

    Screen.MousePointer = vbDefault
    Exit Sub

SortErr:
    Screen.MousePointer = vbDefault
    MsgBox "Sort Error:" & Err & " " & Err.Description
End Sub

Private Sub grdDataGrid_HeadClick(ByVal ColIndex As Integer)
    'let's sort on this column
    If data1.RecordsetType = vbRSTypeTable Then Exit Sub

    'check for the use of the ctrl key for descending sort
    If mbCtrlKey Then
        msSortCol = "[" & grdDataGrid.Columns(ColIndex).DataField & "] desc"
        mbCtrlKey = 0 'reset it
    Else
        msSortCol = "[" & grdDataGrid.Columns(ColIndex).DataField & "]"
    End If
    cmdSort_Click
    msSortCol = vbNullString 'reset it

End Sub



Fri, 27 Jul 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Can't open any more tables - 3014

2. Error 3014: Can't open any more tables

3. Please help: run-time error 3014-can't open any more tables

4. Error 3014: Can't open any more tables

5. Err 3014, can't open any more tables

6. Error 3014: Can't open any more tables

7. Can't open any more tables error 3014

8. Error 3014 (too many Tables open)

9. Sorting the content of list view on clicking column headers

10. sort a listview by column header click

11. List View click on header to sort date column

12. Run-time error 3014 - 'Cannot open any more tables'

 

 
Powered by phpBB® Forum Software