VBobCat VBobCat - 1 year ago 108
Vb.net Question

Provider Microsoft.ACE.OLEDB.12.0 not registered while running in 64bit mode but Access 64bit is there

My computer has both 64bit Office with Access 2016 and 32bit Access 2010 Redistributable installed.

My VB.NET program uses OleDb classes to read and write data stored in a .accdb file.

If I compile it using AnyCPU option, it will halt and show an exception which says "Microsoft.ACE.OLEDB.12.0 provider is not registered", unless I set the "prefer 32 bit" option.

But then my whole application won't benefit from 64bit processing, it will run as 32bit (

IntPtr.Size = 4

Why is that? Shouldn't .NET OleDb classes find the 64bit provider that comes with Access 2016 64bit?

I'll thank anyone who help me understand what occurs here and hopefully guide me on fixing it.

Answer Source

You probably installed the Click-To-Run version of Office 2016. According to Microsoft:

Click-to-Run installations of Office run in an isolated virtual environment on the local operating system. [...] You must install an MSI installation of the Microsoft Access Database Engine from one of the following sources so that the calling application can locate the [Microsoft.ACE.OLEDB.12.0 OLEDB provider].

So, you have the following options:

  • Get rid of the 32-Bit Access Runtime and install, for example, the 64-bit version of the Access 2013 Runtime instead or

  • stick to 32-Bit. There is no supported way to install the Microsoft.ACE.OLEDB.12.0 driver in both the 32- and the 64-bit version on the same machine. (Yes, it's stupid). Alternatively,

  • you might want to switch to another database (such as SQL Sever Express or SQLite). Combining Office products and 64 bit tends to cause a lot of headaches.