BUG: Error Setting Sort to Char Field Greater than 255

ID: Q189837


The information in this article applies to:


SYMPTOMS

When you use an ADO recordset object, you cannot Sort on a field with more than 255 characters.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Visual Basic and create a Standard EXE Project.


  2. On the Project menu, choose References and add a reference to Microsoft ActiveX Data Objects 2.0 Library.


  3. Place the following code in the Load Event of the form:
    
       Private Sub Form_Load()
             Dim rs1 As New ADODB.Recordset
             Dim rs2 As New ADODB.Recordset
             rs1.Fields.Append "F1", adInteger
             rs1.Fields.Append "F2", adChar, 255
             rs1.Open
             rs1.Sort = "F2" '<==  This works
             rs2.Fields.Append "F1", adInteger
             rs2.Fields.Append "F2", adChar, 256
             rs2.Open
             rs2.Sort = "F2" '<==  Error occurs here
       End Sub 


  4. Press F5 to run the code.


RESULT: The following error message appears:
Run-time error '-2147217824 (80040e60)': The requested order could not be opened

Additional query words: kbvbp600 kbADO kbADO200


Keywords          : kbADO200 kbDatabase kbVBp600 
Version           : WINDOWS:2.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 27, 1999