ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to check for existence of a DSN (https://www.excelbanter.com/excel-programming/362675-vba-check-existence-dsn.html)

GPO

VBA to check for existence of a DSN
 
XL 2000
Can anyone point me to a bit of VBA that checks a user's PC for the
existence of a DSN?

Cheers

GPO

Dave Patrick

VBA to check for existence of a DSN
 
You'll need to look in these three places.

file DSN's,
%ProgramFiles%\Common Files\ODBC\Data Sources

system DSN's
You'll need to get the subkey with the DSN names
HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources

and also the subkey for each DSN
HKLM\SOFTWARE\ODBC\ODBC.INI\

Also look for user DSN's in;

HKCU\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources

and also the subkey for each DSN
HKCU\SOFTWARE\ODBC\ODBC.INI\

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"GPO" wrote:
| XL 2000
| Can anyone point me to a bit of VBA that checks a user's PC for the
| existence of a DSN?
|
| Cheers
|
| GPO



NickHK

VBA to check for existence of a DSN
 
GPO,
One way is read the registry. e.g enumerate the values at :
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI

See http://www.vb-helper.com/howto_create_dsn.html for examle.

NickHK

"GPO" wrote in message
...
XL 2000
Can anyone point me to a bit of VBA that checks a user's PC for the
existence of a DSN?

Cheers

GPO





All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com