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
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.