-
I have some code to access the DSNs on the local machine, but I am getting an error
Code:
Dim objDSN As Dsn
Dim strDSArray() As String
Dim I As Long
Set objDSN = New Dsn
objDSN.GetDataSourceList strDSArray()
'list drivers
'list dsns
For I = LBound(strDSArray) To UBound(strDSArray)
lstDNS.AddItem strDSArray(I)
Next I
I just need to know what reference I need to add to access the Dsn. I get an error that user-type not defined.
Thanks in advance
-
As far as I know, there is not a DSN dataa type. May be it could be posible by another way. What exactly do you want to do? Do you want a list of DSN or alist of ODBC drivers?
-
I just want the DSN's. I got this code off this site and nobody said what references you need to make to get this code to work.
-
You can get them from registry.
The User DSN are in:
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI
The System DSN are in:
HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI
Good Look!
-
Add a reference to:
ODBC Driver & Data Source Name Functions
-
That reference is not in my references list. What is the DLL that is associated with that reference.
-
In my PC is: \Windows\System\msado15.dll
Maybe you need to install the MDAC. You can download it from microsoft page.
-
Thanks guys you helped out a lot.