I have installed Office 2013 Professional on a Windows 7 computer.
Following code works if I save the database as an mdb file:
Private Sub bntTest2_Click()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\testKopia.mdb;"
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
sSQL = "SELECT Kundnamn FROM tblKund;"
rs.Open sSQL, cn, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
Debug.Print rs.Fields(0).Value
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cn.Close
End Sub
If I save the same databasfile as an accdb file I get following error message:
"Unrecognizable database format" (80004005). Execusion stops at the connection row.
If I change the connection string like this:
cn.Open "Provider='Microsoft.ACE.OLEDB.12.0';'Data Source=H:\testKopia.accdb';Persist Security Info=False;"
I get following error message:
"Could not find the Provider. It may not be properly installed." (Runtime error '3706').
I have following references:
- Visual Basic For Applications
- Microsoft Access 15.0 Object Library
- OLE Automation
- Microsoft Office 15.0 Access database engine Object Library
- Microsoft ActiveX Data Objects 2.8 Library
Have I missed a reference or is there something missing in the installation? It is a standard installation.
/Hans
Hans Hansson