Getting WorkstationID

D

Derek

I'm building a DSN connection on the fly in VB
NewPath = "ODBC;DSN=" & sNewDSN & ";Description=" & sNewDSN & ";UID=administrator;APP=Microsoft Office XP;WSID=ServerName;DATABASE=" & sNewDB & ";Network=DBMSSOCN;Trusted_Connection=Yes

However the application needs to be copied to several servers. Therefore I need to work out the WSID part in code, rather than hardcoding it to "Servername" as in the above example

Can anyone tell me how to do this

Thanks in advanc
Derek
 
M

mudraker

Have a look at the Environ settings

I have only used these on NT but I beleive they also apply to othe
Window versions

Sub ddd()
Dim i
For i = 1 To 57
Debug.Print "i = " & i & " " & Environ(i)
Next
End Su
 
B

Bob Phillips

It is better to use

environ("Computername")

then you don't get the prefix, it is more descriptive, and will work where
it is not index 5.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top