Link to home
Start Free TrialLog in
Avatar of ecomaster
ecomaster

asked on

No items are created by the set adocon statement.

Hi,

I seemed to have messed up my Excel/vba configuration, because this Excel macro does run on one PC, but does not any longer run on the my first PC.

Following problem:

Set adocon = New ADODB.Connection
adocon.Properties("data source") = DB_DSN

The first line works 'OK', but the second line gives the error "Method 'Item' of object 'Properties' failed". In the locals view window, I unfolded adocon and I got this:
...
-adocon
  -Properties
    - Count                     <Application-defined or object-defined error>
...

On the PC where it works all the items are visible. There is no other difference.

Anyone an idea, whether I should add other references (same on the two PC's), or other things??

THanks !








Avatar of gary_j
gary_j
Flag of United States of America image

Can I see your "dim" statements?  I've never used this methodology so I need to know how DB_DSN is dimmed
Avatar of ecomaster
ecomaster

ASKER

Sub InitDB(DB_UID As String, DB_PW As String, adocon As ADODB.Connection, DB_DSN As String)

'Open Database
Set adocon = New ADODB.Connection
adocon.Properties("data source") = DB_DSN
adocon.Properties("user id") = DB_UID
adocon.Properties("password") = DB_PW
adocon.Open

End Sub

This procedure is called each time I need to access the database. In the local view, the DB_... are received correctly.
what version of mdac are you using?  did you recently change it?  i'm having no trouble at 2.5 or 2.8
I have version 2.7. But as I mentioned, there is no problem on one of my PC's, so I think it's more of a configuration error. The code was already operational.
ASKER CERTIFIED SOLUTION
Avatar of gary_j
gary_j
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
YES !!

It couldn't have been simplier, mea culpa, but I didn't know this MDAC was actually performing this functionality.

Thanks very much!!!