ACC2: "Type Conversion Failure" with Update or Append QueryLast reviewed: May 14, 1997Article ID: Q125259 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you run an append or update query, you receive a "type conversion failure" error message when a query parameter is not explicitly declared. For example, an update query fails if its Update To parameter is a reference to a form control.
CAUSEThe query parameter is implicitly declared and, as a result, is automatically treated as text. The conversion fails, resulting in the error message. Note that the error message occurs only if you are using the Microsoft Jet database engine version 2.5, which is installed when you install the Microsoft Access version 2.0 Service Pack.
RESOLUTIONTo resolve this problem, either wrap the parameter with a conversion function such as CVDate(), CLng(), or CCur(), or explicitly declare the parameter's data type in the Parameters dialog box. (To use the Parameters dialog box, choose Parameters from the Query menu.) If you want to automate the process of explicitly defining parameter data types, you can install a utility application called Params.exe. For information on how to obtain Params.exe, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q149357 TITLE : ACC2: Parameter Typing Utility Available on MSL STATUSMicrosoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.
MORE INFORMATIONWhen you use a parameter in a query without defining the parameter's data type in the Parameters dialog box, the parameter is implicitly declared. Parameters whose data type is declared in the Parameters dialog box are explicitly declared. Parameters that return values from a conversion function are also considered to be explicitly declared. This problem affects some of the append and update queries in the Microsoft Access Solutions Pack Asset Tracker application. For example, no reports are listed in the Select Reports form, and no assets are listed in the Reassign Assets form. The queries that fill the temporary tables on which these forms are based are failing.
Steps to Reproduce ProblemThe following example uses a default date value in a text box on a form as a parameter for an update query:
Steps to Correct the Problem Using an Explicit ParameterThe following examples show how to correct the problem demonstrated by the example in the "Steps to Reproduce Problem" section above. CAUTION: Following the steps in these examples will modify the sample database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform these steps on a copy of the NWIND database.
Method 1
Method 2
REFERENCESFor more information about parameters, search for "parameter query," and then "Creating a Parameter Query" using the Microsoft Access Help menu. For information about the Microsoft Access version 2.0 Service Pack, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q122927 TITLE : WX1124: Microsoft Access Version 2.0 Service Pack |
Additional query words: forms queries jet25 jet 2.5
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |