oledb connection to SQL Server not working

Posted on 2010-08-13
Medium Priority
Last Modified: 2013-11-27
In Access 2007, (trying to access SQL Server) I have the following code:
    Dim cn As New ADODB.Connection
    Dim strCN As String
    strCN = "Provider=SQLOLEDB;Server=;" & _
             "Initial Catalog='Websites';User ID=sa;PWD=xxxxxxxx"

    cn.CommandTimeout = 3000000

This gives the following error:
[Microsoft][ODBSC Driver Manager] Data Source Name not found and no default driver specified
Question by:jking1234
  • 2
LVL 24

Expert Comment

ID: 33430247

I would recommend to use the SQLNCLI driver instead (must be installed on Windows XP machines, not available by default).

Moreover you should make sure that TCP/IP is enabled on the SQL Server if you access the server by IP address.
You can find examples of connection strings here:

There is also an example of how to use the IP address.

And I hope that this string was only an example and you don't really try to connect to the SQL Server using the "sa" account...:-)



Accepted Solution

jking1234 earned 0 total points
ID: 33544602
fixed it myself

Author Comment

ID: 33544625

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Implementing simple internal controls in the Microsoft Access application.
If you need to implement application level security in an Access database application or other VBA code, I strongly encourage you to take advantage of Active Directory groups.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question