ACC2002: Error Message: "Run-Time Error. Requested Conversion Is Not Supported" (282320)
The information in this article applies to:
This article was previously published under Q282320 Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies only to a Microsoft Access project (.adp).
SYMPTOMS
When you use calculated columns that contain data of the Variant data type, you receive the following error message:
Microsoft Visual Basic
Run-time error '-2147217891 (80040e1d)':
Requested conversion is not supported
CAUSE
Access does not use consistent behavior with calculated columns that are based on the Variant data type.
RESOLUTION
Replace variant with non-variant data. In the code example in the "More Information" section of this article, replace the rs(0) = "string" line of code with rs(0) = 5 so that the code looks as follows:
Sub ShapeTest()
' Dimension connection and recordset objects for this module.
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New Recordset
' Open the connection using the Shape provider.
cn.Open "Provider=MSDataShape;Data provider=MSPersist;"
' Append 2 columns to the existing recordset. One column is of Variant
' data type and the other column is of Integer data type.
rs.Fields.Append "Col1", adVariant
rs.Fields.Append "Col2", adInteger
'Open the recordset. Add a new record to the recordset.
rs.Open
rs.AddNew
' Set the recordset's first column data equal to the Integer value of 5.
rs(0) = 5 ' This line changed from rs(0) = "string" (variant data).
' Set the recordset's second column data equal to 1, an Integer value.
rs(1) = 1
' If the file exists, delete it.
If Dir("c:\temp\test1.temp") <> "" Then Kill "c:\temp\test1.temp"
' Save the recordset to the specified file name using ADTG format.
rs.Save "c:\temp\test1.temp", adPersistADTG
' Close the recordset.
rs.Close
' Open another recordset and use the Shape provider. Use the previously
' saved file and combine its data with the results of the first column
' multiplied by 2. The "CALC(col1*2)" part of this statement is the
' calculated column.
rs2.Open "SHAPE TABLE[c:\temp\test1.temp] APPEND CALC(col1*2)", cn, , , -1
' In the Immediate window, print the calculated column results.
Debug.Print rs2(2) 'errors occurred
End Sub
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 11/6/2003 |
---|
Keywords: | kberrmsg kbprb KB282320 |
---|
|