ADO connection not working on windows 10 laptops

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
I have a macro which uses the following connection string below. This works great on our 64bit windows 8.1 which is running 32bit excel and access (our database we connect to). However, we have some new laptops with windows 10 64bit and 32bit excel and access which it creates the 3706 provider not found error when trying to open the connection. I checked the common files folder and the oledb dll file is there. Any ideas?

Code:
Public Sub SQLOpenDatabaseConnection(StrDBPath As String, EngineType As Integer)
 
    'Define Connection String by inputting StrDBPath into a larger string (Works for Excel DB)
    'Define Connection String by inputting StrDBPath into a larger string
    'Access Support for engine type
    If EngineType = 0 Then
    
        sConn = "Provider=Microsoft.ACE.OLEDB.15.0;" & _
                                 "Data Source=" & StrDBPath & ";" & _
                                 "Jet OLEDB:Engine Type=5;" & _
                                 "Persist Security Info=False;Mode=Share Exclusive;"
    
    'Excel Support for engine type
    ElseIf EngineType = 1 Then
        
        sConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & StrDBPath & "';" & _
             "Extended Properties=""Excel 12.0;HDR=NO;ReadOnly=0;"";"
    
    End If
    
RetryConnection:
    Sleep 100
    DoEvents
    On Error GoTo ErrorHandler
        'Connect to the database


20       oConn.Open sConn


    On Error GoTo 0


Exit Sub


ErrorHandler:
'triggered by connection error. Most likely locking type
'MsgBox "looks like we had a connection error. The error number is " & Err.Number & " and the description is " & Err.Description & " on line " & Erl


Err.Clear
Resume RetryConnection


End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Anyone? The references for the windows 10 and the windows 7 are the same and all of them show up when checked.
 
Upvote 0
As far as I know, the provider should be Microsoft.ACE.OLEDB.12.0 rather than Microsoft.ACE.OLEDB.15.0 for any version 2007 onwards.
 
Upvote 0
As far as I know, the provider should be Microsoft.ACE.OLEDB.12.0 rather than Microsoft.ACE.OLEDB.15.0 for any version 2007 onwards.

I cannot find to much information comparing 15 to 12. Do you know what the differences might be? I will switch to 12 though to see if it fixes the issues.
 
Upvote 0
There is no difference as far as I know. There is only one provider and it's version 12.
 
Upvote 0
That did the trick and fixed it! Thanks as usual Rory! I wonder why 15 was working for windows 8.1 but not for 10.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top