PRB: Error Message "Unspecified Error" When Filtering on the 501st Column in an ADO Recordset (290796)



The information in this article applies to:

  • ActiveX Data Objects (ADO) 2.6
  • ActiveX Data Objects (ADO) 2.7
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0 SP3
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0 SP4
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0 SP5

This article was previously published under Q290796

SYMPTOMS

When you use ActiveX Data Objects (ADO) to set a filter on the 501st column in an ADO recordset, you receive the following error message:
Run-Time Error -2147467259(80004005) Unspecified Error

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Visual Basic, open a new Standard EXE project. Form1 is added to the project by default.
  2. On the Project menu, click to select References. From the list of available references, select Microsoft ActiveX Data Objects 2.x Library.
  3. Add a CommandButton to Form1.
  4. Paste the following code into the Click event of Command1:
    Dim ors As New ADODB.Recordset
    Dim x As Long, i As Long
    
    ' Create a Recordset with 1000 columns
    For x = 1 To 1000
        ors.Fields.Append "f" & x, adInteger, 0, adFldIsNullable Or adFldUpdatable
    Next
    ors.Open
    
    ' Add 10 records to it
    For x = 1 To 10
        ors.AddNew
        For i = 0 To ors.Fields.Count - 1
            ors.Fields(i).Value = 100
    Next
        ors.Update
    Next
    ors.MoveFirst
    
    ' Set a filter
    For x = 1 To 1000
        'Next line will fail when x is >= 502
        ors.Filter = "f" & x & " > 250"
        ors.Filter = adFilterNone
    Next
    					
  5. Run the project, and note that the error message occurs when x is equal to or greater than 502.

Modification Type:MajorLast Reviewed:6/25/2004
Keywords:kbprb KB290796