Helena Viljoen
Helena Viljoen

Reputation: 19

'3706': Provider cannot be found when trying to connect to SQL SERVER VIA VBA

I am trying to connect to my SQL Server in Excel VIA VBA.

I am getting stuck with the Connection string, it doesn't want to open. I keep on getting the error - Provider can not be found. It may not be properly installed.

Here is my code to connect:

Option Explicit

Const SQLConStr As String = "Provider=SQLNCLI10;Server=XXX\XXX;Database=XXX;Trusted_Connection=yes;"


Sub ConnectToDB()

    Dim PolicyDetails As ADODB.Connection
    Set PolicyDetails = New ADODB.Connection
    
    PolicyDetails.ConnectionString = SQLConStr 
    
    PolicyDetails.Open
    
    PolicyDetails.Close
    
    Set PolicyDetails = Nothing

End Sub

I have read a few of the previous questions regarding 32-bit/ 64- bit , but everything on my computer is run on 64-bit.

Does anyone else know why is doesn't want to connect to my Database

Upvotes: 0

Views: 1830

Answers (1)

Abhishek
Abhishek

Reputation: 11

Try using "SQLOLEDB" or "SQLNCLI11" in your SQLConStr String instead of "SQLNCLI10"

Upvotes: 1

Related Questions