The information in this article applies to:
SYMPTOMSWhen using the ADO Parameters.Refresh method with a text datatype parameter on a parameterized Microsoft Access 97 QueryDef, error 3708 may occur: 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. CAUSEThe 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. STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATIONSteps to Reproduce BehaviorThe following example shows ways to return an ADO recordset from a Microsoft Access QueryDef that expects a parameter to return a recordset of one or more rows. The sample application has two procedures that use Microsoft Access 97 parameterized QueryDefs.The first procedure shows an example of passing a numeric parameter while the second procedure shows an example of passing a text parameter. These two procedures show how using the ADO Parameters.Refresh method retrieves Parameter properties and returns an ADO recordset. NOTE: You will need to acquire and install Microsoft Data Access Components (MDAC) for the sample in this article. The first requirement is to create the Microsoft Access 97 QueryDefs. This article assumes that you are familiar with creating new QueryDefs in Microsoft Access 97. The following Visual Basic code expects two new QueryDefs in the sample Nwind.mdb included with Visual Basic. Create the new QueryDefs with the following properties:
Make sure you also set the parameter name and datatype in Microsoft
Access 97. From the Query menu, choose Parameters. Create each query with three fields.After the Microsoft Access 97 QueryDef's are created, open a new Visual Basic Project. Form1 is created by default.
Run the example and click the CustomerByID button. The Debug window
displays the returned values. Comment the Cmd2.Parameters(0).Size = 5 line
and rerun the example. The error occurs. REFERENCESFor information on creating a Parameter collection for an Access 97 Querydef please see the following article in the Microsoft Knowledge Base: Q181782 HOWTO: Work with Access Querydef Parameter Using VBMicrosoft 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: Q175018 HOWTO: Acquire and Install the Microsoft Oracle ODBC Driver Additional query words: ado Access
Keywords : kbcode kbADO150 kbADO200 kbDatabase kbGrpVBDB kbGrpMDAC kbDSupport kbADO210sp2 kbMDAC210SP2 |
Last Reviewed: November 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |