Event raised before object is set
Posted on 2006-04-11
I wrote an activex DLL that holds a class which handles connecting to an Access or SQLServer DB.
the class has different properties like DB password, Save DB path to registry, etc.
the only public function is this:
Public Function CreateConnection(Optional DBPath As String) As ADODB.Connection
which handles the all connection operation and as you can see it returns a connection object to set the one in the application that uses this activex.
my problem is that im raising a Connection_Successful event in the CreateConnection function/
If i try writing a code that accesses the database in the sub that handles this event using my connection object i get an error that my object is not set which is true since the CreateConnection function didnt return the object yet.
is there a way to make the Connection_Successful event raise after the function that raised it has returned the object?