PRB: Setting ADO Recordset Cachesize with JET OLEDB Provider Returns Error with MDAC 2.1 SP2

ID: Q245836


The information in this article applies to:
  • Microsoft Visual Basic Enterprise Edition for Windows, versions 5.0, 6.0


SYMPTOMS

Attempting to set the ActiveX Data Objects (ADO) recordset's Cachesize property returns the following error message:

Run-time error '3001':
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
This error occurs when Microsoft Data Access Component (MDAC) version 2.1 SP2 is installed on the computer and a JET OLEDB provider has been used to create the ADO connection.


RESOLUTION

The current workaround is to use the Microsoft Access ODBC driver when creating the ADO connection.


MORE INFORMATION

The following steps allow you to reproduce the problem. Uncommenting the line to use the Microsoft Access ODBC driver when creating the ADO connection allows the code to run without an error.

Steps to Reproduce Behavior

  1. Create a new Standard EXE Project in Visual Basic.


  2. From the Project menu, choose References, and then select Microsoft ActiveX Data Objects 2.1 Library.


  3. Add a command button to Form1.


  4. Add the following code into the General Declarations of Form1:


  5. 
    
    Dim oConn As ADODB.Connection
    Dim oRS As ADODB.Recordset
    
    
    
    Private Sub Command1_Click()
    
       Set oConn = New ADODB.Connection
    
          ' ODBC DSN to Jet (Access)
    '   oConn.Open "DSN=nwind;" & _
                           "UID=Admin;PWD=;"
    
       ' OLE DB Provider for Jet (Access)
       oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb"
    
       
       Set oRS = New ADODB.Recordset
    
       Set oRS = oConn.Execute("Select * from Customers")
      
       oRS.CacheSize = 30 ' Error occurs here<BR/>
    
       MsgBox "The CacheSize is set to " & oRS.CacheSize
    
    End Sub
     
  6. When using the ODBC driver, after setting the CacheSize, in the Immediate Window type:

    
        "? oRS.CacheSize" (without the quotes) 


    RESULT: The value 30 is returned.


Additional query words:

Keywords : kbGrpVBDB kbGrpMDAC kbDSupport kbADO210sp2
Version : WINDOWS:5.0,6.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: December 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.