BUG: Use of 16-bit Client & DAO Object Causes Error '8002802b' (149035)



The information in this article applies to:

  • Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
  • Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0

This article was previously published under Q149035

SYMPTOMS

Assigning a passed DAO object to a specific object variable fails with error "8002802b" when using the 16-bit edition of Microsoft Visual Basic version 4.0 for Windows. This error occurs on either the client or server side, if the DAO object in question has been passed from the other application.

WORKAROUND

Declare the variable(s) that hold the references to the passed object with "As Object" instead of "As Database" or "As Recordset". The code that manipulates these "As Object" variables does not need to change.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps To Reproduce Issue

  1. Create a minimal OLE server and a client that accesses the OLE server. To obtain step-by-step instructions on how to accomplish this functionality, please see the following article in the Microsoft Knowledge Base:

    129801 How to Create and Use a Minimal OLE Automation Server

    For clarity purposes, the following steps assume a client and server created from the article referenced above. However, these steps can be implemented in any client and server to see the behavior described in this article.
  2. Add this function to the class module in the server project:
          Public Function GetDB() As Object
             Set GetDB = OpenDatabase("Biblio.mdb")
          End Function
    						
  3. Press F5 or click Start on the Run menu to run the server application.
  4. Change the Form_Click event in the client application to contain this code:
          Private Sub Form_Click()
             Dim x As Object
             Dim db As Database
             Dim rs As Recordset
    
             Set x = CreateObject("Project1.Class1")
             Set db = x.GetDB
             Set rs = db.OpenRecordset("Authors")
          End Sub
    						
  5. Press F5 or click Start on the Run menu to run the client application. Click on the form to execute the code added in step 4. The client returns the above mentioned error on the line calling the GetDB method of the server. If you change the declare for the db variable from "As Database" to "As Object" this line executes successfully. However, the next line fails with the same error, as the rs variable is declared "As Recordset." Changing the rs variable to "As Object" corrects this problem and the code runs to completion correctly.

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:kbbug KB149035