Run-time error 3706 Provider cannot be found

nightheart

New Member
Joined
Feb 9, 2012
Messages
10
Hi,

I'm running Windows 7 64 bit and Office 2010 32 bit. I'm trying to run an access query from excel using VBA but i got the above mentioned error at the highlighted step.
Code:
Dim cn As ADODB.Connection
Dim strName As String
Dim strSQL As String
Dim strConnection As String
Dim rs As ADODB.Recordset


Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset


strName = Application.InputBox("Please enter the file location....", "File path")


With cn
.Provider = "Provider=Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=" & strName & " ;"
[COLOR=#ff0000].Open[/COLOR]
End With

Would you please help me with that error. Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I think that should be:
Rich (BB code):
.Provider = "Microsoft.ACE.OLEDB.12.0"

rather than
Rich (BB code):
Rich (BB code):
.Provider = "Provider=Microsoft.ACE.OLEDB.12.0"
 
Upvote 0

Forum statistics

Threads
1,211,685
Messages
6,103,290
Members
447,853
Latest member
olddutch7

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