Microsoft Knowledge Base Email Alertz

(224422) - When you return a user-defined data type (UDT) from a Visual Basic COM object, you might get one of the following error messages: Microsoft VBScript runtime error '800a01a8' Object required -or- Response object error 'ASP 0106 : 80020005' Type...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 224422 - Last Review: July 16, 2004 - Revision: 3.2

PRB: Returning a UDT from a VB COM Object Brings an Error

This article was previously published under Q224422

On This Page

SYMPTOMS

When you return a user-defined data type (UDT) from a Visual Basic COM object, you might get one of the following error messages:
Microsoft VBScript runtime error '800a01a8'
Object required
-or-
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered

CAUSE

User-defined data types are not supported in the current version of Active Server Pages (ASP).

RESOLUTION

Active Server Pages does not support UDTs, but you can work around this by creating a new class to handle the data in place of the UDT and setting the instancing property to PublicNotCreateable. This will ensure that you can pass the necessary information to and from ASP, as well as ensuring that the class cannot be created outside of the DLL.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Visual Basic ActiveX DLL project called VBUDTPrj.
  2. Add class module called VBUDTObj.
  3. Define a UDT as follows:
    Public Type TestUDT
       strName as String
       strDept as String  
    End Type
    						
  4. Implement the following method:
    Public Function TestMethod() As Variant
        Dim udtTestData As TestUDT
        
        udtTestData.strDept = "TestDept"
        udtTestData.strName = "TestName"
        
        TestMethod = udtTestData    
    End Function
    						
  5. Create an ASP page that calls this method:
    <%
       Dim objTest, udtData
       Set objTest = Server.CreateObject("VBUDTPrj.VBUDTObj")
       udtData = objTest.TestMethod()
    
       Response.Write( "Name = " & udtData.strName & "<BR>" )
       Response.Write( "Dept = " & udtData.strDept & "<BR>" )
    %>
    						
  6. Run the ASP page. The the following error occurs:
    Microsoft VBScript runtime error '800a01a8'
    Object required

REFERENCES

See the TYPE statement in the Visual Basic Documentation.

APPLIES TO
  • Microsoft Active Server Pages 4.0
  • Microsoft Visual Basic 5.0 Learning Edition
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0
Keywords: 
kbcodesnippet kberrmsg kbprb KB224422
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate