The information in this article applies to:
- Professional and Enterprise Editions of Microsoft Visual Basic,
16-bit only, for Windows, version 4.0
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
- 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:
ARTICLE-ID: Q129801
TITLE : 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.
- Add this function to the class module in the server project:
Public Function GetDB() As Object
Set GetDB = OpenDatabase("Biblio.mdb")
End Function
- Press F5 or click Start on the Run menu to run the server application.
- 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
- 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.