PRB: ADO Parameter Refresh Error with Access 97 Querydef and Visual Basic (181716)
The information in this article applies to:
- ActiveX Data Objects (ADO) 1.5
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.1 SP2
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
This article was previously published under Q181716 SYMPTOMS
When using the ADO Parameters.Refresh method with a text datatype parameter
on a parameterized Microsoft Access 97 QueryDef, error 3708 may occur:
The application has improperly defined a Parameter Object.
In version 2.6, the error message is:
Parameter object is improperly defined, inconsistent or incomplete information was provided.
This occurs because a size of zero (0) is returned on the text datatype
parameter by the ADO Refresh method.
This article has an example of how to use the ADO Refresh method on a
parameterized Microsoft Access 97 QueryDef. Using the Refresh method does
result in a round trip to the server so if performance is important, it
would be better to create a Parameter collection and define the parameter
properties in code.
CAUSE
The ADO Parameters.Refresh method does not return the actual parameter Size
property, the method returns a value of 0. Microsoft Access's parameter
syntax does not allow for the size of the parameter to be set in the
QueryDef. Setting the Size property of a text datatype parameter to 0 or a
value less than the actual size of the text field results in an error when
executing the ADO command that passes this parameter.
RESOLUTION
To work around this error it is necessary, in your code, to set the text
datatype parameter .Size property to a value equal to or greater than the
actual field size. The following example shows how to define the Size
property when working with a text datatype parameter.
NOTE for ADO 2.1 and later versions: The REFRESH method does NOT return information about the .Name or .Type properties of the Parameters collection as it does in ADO 2.0. Therefore, it is necessary to assign a value to the .Type property. If you need to reference the parameter by name, you also need to assign a value to the .Name property.
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
REFERENCES
For information on creating a Parameter collection for an Access 97
Querydef please see the following article in the Microsoft Knowledge Base:
181782 HOWTO: Work with Access Querydef Parameter Using VB
Microsoft Data Access Components (MDAC) contains ADO, which is needed for this article. For more information on MDAC, please see the following article in the Microsoft Knowledge Base:
175018 HOWTO: Acquire and Install the Microsoft Oracle ODBC Driver
Modification Type: | Minor | Last Reviewed: | 3/2/2005 |
---|
Keywords: | kbcode kbDatabase kbDSupport kbprb KB181716 |
---|
|