I am trying to use use VBA to sync data to and from excel. When I try to sync from the database I get "Run-Time error 3706 Provider cannot be found. It may not be properly installed." I'm not sure what this error means. I've looked online for solutions and have just further confused myself. I'm not sure if I need to change my VBA or what.
Here is the code I'm using:
Sub SyncFromDatabase()
LastLocalChange = Sheet1.Range("B11").Value
DbFile = Sheet1.Range("SharedFolder").Value
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(DbFile)
If objFile.DateLastModified > LastLocalChange Then
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=MicrosoftACE.12.0;" & "Data Source=" & Sheet1.Range("SharedFolder").Value & ";Extended Properties=""Excel 12.0 Xml;HDR=Yes;IMEX=0"";"
objRecordset.Open "Select*FROM [CustDb$]", objConnection
Sheet2.Range("A2").CopyFromRecordset objRecordset
objRecordset.Close
RefreshContactTable
End If
End Sub
The error is occurring in the obj.Connection.Open section of the VBA. If any one can please help I would be so thankful!
Bookmarks