View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MH[_2_] MH[_2_] is offline
external usenet poster
 
Posts: 52
Default Connecting to SQL Server via VBA and ADO

http://support.microsoft.com/kb/328306

MH

"leonard webel" wrote in message
...
Hi,

Im trying to connect to a sqlserver using this:

MyConnObj.Open _
"Provider = sqloledb;" & _
"Data Source={ServerName};" & _
"Initial Catalog={DatabaseName};" & _
"User ID={UserName};" & _
"Password={Password};"

But I am getting an error message:

Run-time error '-2147467259 (80004005)':

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access
denied

I have got a System DSN which does connect to the database successfully.
It
is using standard SQL server connection. If i could supply the system DSN
Im
sure it would work?

Please help
Thanks