Microsoft KB Archive/245836

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

Article ID: 245836

Article Last Modified on 7/28/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft ActiveX Data Objects 2.1
 * Microsoft ActiveX Data Objects 2.1 Service Pack 2
 * Microsoft ActiveX Data Objects 2.5

-



This article was previously published under Q245836



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
 Create a new Standard EXE Project in Visual Basic. From the Project menu, choose References, and then select Microsoft ActiveX Data Objects 2.1 Library. Add a command button to Form1.  Add the following code into the General Declarations of Form1: 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

MsgBox "The CacheSize is set to " & oRS.CacheSize

End Sub

  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. </li></ol>

Keywords: kbprb kbmdacnosweep KB245836

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.