Hey Everyone,
In my workbook I am trying to connect to a local server using an ADODB conneciton referening the activex data objects 2.8 lib. I am using code that I copied from an old project of mine that works just fine, however it is not working when I modify it to use (local) as the server, rather than an actual server name. The old code is:
The new code is the same, with (local) replacing server in the above code. Does anyone have any idea as to why this is not working? Is it maybe not possible to connect to a local server using this type of connection? Thanks so much in advance.
-medberg
In my workbook I am trying to connect to a local server using an ADODB conneciton referening the activex data objects 2.8 lib. I am using code that I copied from an old project of mine that works just fine, however it is not working when I modify it to use (local) as the server, rather than an actual server name. The old code is:
Code:
Dim cnt As ADODB.Connection
Dim cmd As New ADODB.Command
Set cnt = New ADODB.Connection
cnt.ConnectionString = "Provider=SQLNCLI;DATABASE=" + database + ";SERVER=" + server + ";Integrated Security=SSPI;Trusted_Connection=Yes;APP=2007 Microsoft Office system;DataTypeCompatibility=80;"
cnt.Open
cmd.ActiveConnection = cnt
exportQuery = query
cmd.CommandText = exportQuery
cmd.Execute
The new code is the same, with (local) replacing server in the above code. Does anyone have any idea as to why this is not working? Is it maybe not possible to connect to a local server using this type of connection? Thanks so much in advance.
-medberg