Question

I'm wondering how to connect to MS Access 2013 database from Delphi XE 2? I usually use "Provider=Microsoft.ACE.OLEDB.12.0" for MS Access 2010 but it's not working anymore with 2013? any idea ??

Was it helpful?

Solution

I just tested the following VBScript code on a Windows_7 machine with 64-bit Access_2013...

Option Explicit
Dim con, rst
Set con = CreateObject("ADODB.Connection")
con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=C:\Users\Gord\Desktop\Database1.accdb;"
Set rst = CreateObject("ADODB.Recordset")
rst.Open "SELECT Field1 FROM Table1", con
Wscript.Echo rst("Field1").Value
rst.Close
Set rst = Nothing
con.Close
Set con = Nothing
Wscript.Echo "Done."

...and it worked fine, so I don't believe that the Provider= string you cited is the problem per se. There must be something else wrong with your setup.

EDIT

Comparing two Windows_7 machines, one with 64-bit Office_2010 and the other with 64-bit Office_2013, revealed an important difference:

  • The machine with 64-bit Office_2010 had both the 32-bit and 64-bit versions of the Access Database Engine (ACE) installed.

  • The machine with 64-bit Office_2013 had only the 64-bit version of ACE. The 32-bit version of ACE was NOT present.

Re-running my VBScript test confirmed this:

C:\__tmp>c:\windows\system32\cscript.exe /nologo oledbTest.vbs
Hello
Done.

C:\__tmp>c:\windows\sysWOW64\cscript.exe /nologo oledbTest.vbs
C:\__tmp\oledbTest.vbs(4, 1) ADODB.Connection: Provider cannot be found. It may not be properly installed.

Fortunately, users of 64-bit Office_2013 can download and install the 32-bit version of ACE from here if they have 32-bit applications that need to work with .accdb files.

For users of 32-bit Office_2013 on 64-bit Windows, I suspect that the situation is the same as users of 32-bit Office_2010: They only have the 32-bit version of ACE and are unable to install the 64-bit version unless they uninstall 32-bit Office first. So, if you have 32-bit Office installed and you want to run a 64-bit app that needs to work with .accdb files then I believe that you are "out of luck". (Alas, I am unable to test this as I only have a 64-bit Office_2013 install available.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top