Hi!
You cannot pass any parameters to the initilizing of the ActiveX (COM) object. You can workaround this by moving initializing code to some otehr method with parameters and call that method just after object initialization.
>I have an activex dll that manages connections to an access database. The access database is protected by Access' User/Group security feature where a user has to enter a user name and password. I have the following code in my class_initialize routine:
>
>Private Sub Class_Initialize()
>
> Set cnResources = New ADODB.Connection
> cnResources.ConnectionString = "DSN=CompRes;"
>
>End Sub
>
>
>However, since the database implements security restricttions, I have to change the connection string to:
>
> cnResources.ConnectionString = "DSN=CompRes;uid=" & strUser & ";pwd=" & strPwd
>
>From my Main application, I have this:
>
>Dim objServer As clsServer
>
>Sub Form_Load()
>
> Set objConn = New clsConn
> Set rsGeneric = objConn.OpenRecordset("Main")
>
>...
>
>End Sub
>
>The problem is, I don't know how to pass the strUser and strPWD variables to the Class_Initialize sub.
>
>I tried putting variables in the Sub_Initialize statement like:
>
>Sub Class_Initialize(var strName as String, var strKey as String)
>
>But all I get is an error.
>
>WOuld appreciate any assistance you could offer, including alternatives. Thanks in advance.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.