ACC2: "Type Conversion Failure" with Update or Append QueryID: Q125259
|
Moderate: 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.
The 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.
To 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:
Q149357 ACC2: Parameter Typing Utility Available on MSL
Microsoft has confirmed this to be a problem in Microsoft Access version
2.0. This problem no longer occurs in Microsoft Access version 7.0.
When 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.
Query: Updater
--------------------------------
Type: update query
Field: Birth Date
Table: Employees
Update To: Forms!Test1!Field0
Text Box
------------------------
Name: Field0
Format: Short Date
Default Value: ="1/1/95"
Command Button
-----------------------------
Name: Button0
Caption: Run Updater Query
Sub Button0_Click ()
DoCmd OpenQuery "Updater"
End Sub
Errors were encountered: 15 fields were not updated due to type
conversion failure, 0 record(s) were not updated due to key
violations, and 0 record(s) were not updated due to lock
violations. Continue anyway?
Parameter: Forms!Test1!Field0
Data Type: Date
CVDate(Forms!Test1!Field0)
For 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:
Q122927 WX1124: Microsoft Access Version 2.0 Service Pack
Additional query words: forms queries jet25 jet 2.5
Keywords : kbusage QryUpdat
Version : 2.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 9, 1999