Connecting to SQL Server via VBA and ADO

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top