Thread: connect to sql
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.querydao,microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default connect to sql

Missing drivers?

Tim

--
Tim Williams
Palo Alto, CA


"Andre" wrote in message
...
Excel 2000, 2003

I've built an app that connects to sql and does various things. On some
machines it works just fine, on other machines it throws an error. The
error occurs when I attempt to connect to sql. The error is:
Run-time error '-2147467259 (80004005)';
Automation error
Unspecified error


My connection code is below.
Sub Connect()

Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection
sADOConnect = "DSN=MyDSN;UID=MyUID;PWD=MyPwd"

With cn
.CursorLocation = adUseClient
.ConnectionString = sADOConnect
.ConnectionTimeout = 180
.CommandTimeout = 180
.Properties("Prompt") = adPromptCompleteRequired
.Open
End With

End Sub

Can anyone tell me what is causing this error, and how I can get around

it?

Thanks, Andre