Connecting to SQL Server via VBA and ADO

  • Thread starter Thread starter leonard webel
  • Start date Start date
L

leonard webel

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
 
Back
Top