Mit VBA prüfen, ob Server-DSN existiert
VBA - prüfen, ob Server-DSN existiert
Hi NG,
nochmals eine Frage zum Thema System-DSN.
Wie kann ich per VBA prüfen, ob eine System-DSN auf dem Rechner existiert?
Gruß
Andy
nochmals eine Frage zum Thema System-DSN.
Wie kann ich per VBA prüfen, ob eine System-DSN auf dem Rechner existiert?
Gruß
Andy
Please also mark the comments that contributed to the solution of the article
Content-Key: 157940
Url: https://administrator.de/contentid/157940
Printed on: April 19, 2024 at 23:04 o'clock
1 Comment
Moin Moin
So in etwa solte das funktionieren:
Gruß L.
So in etwa solte das funktionieren:
On error resume next
Set oShell = WScript.CreateObject("WScript.Shell")
strKeyPath = "SOFTWARE\ODBC\ODBC.INI\"
myDNS = "NameDerGesuchtenDSN" ' <- Hier must du natürluch den Namen deiner DSN angeben
DBName = oShell.RegRead("HKEY_LOCAL_MACHINE\" & strKeyPath & myDNS & "\Database")
if DBName <>"" Then
wscript.echo "DSN: " & myDNS & " existiert."
end if
Gruß L.