For anyone who lands here, I hope this helps.
My old PC ran Windows 10 64-bit, and 32-bit versions of Access and VS. Any VS project the accessed an Access database would run fine as long as the target CPU was x86.
If I inadvertently forgot to set the CPU to x86, I would get the error: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine".
On a new PC, I run Windows 11, Access 2021, Visual Studio 2022. All 64-bit. I attempted to port several projects from my old PC. VS2022 will convert the project to new format, but I would get the provider not registered error.
1. Check that you have the provider -- see Tanya's 7/31/2023 note above and run her power shell command.
2. If you want to convert to ODBC, see Castorix31's note above.
3. If you want to continue with OLEDB, there are 3 settings in project properties to change:
Set Platform to x64 (Any CPU may work)
Set Target CPU to x64
Un-check "Prefer 32-bit" (Important -- the default in VS is checked.)
Be sure to change the settings in both Release and Debug configurations.
With the above changes, all my projects accessing Access database compiled and ran successfully.
How to Connect to Access database thru Visual Studio 2022
I have Windows 11, Access 2021, and Visual Studio 2022 installed -- all 64-bit.
I am trying to connect to Access database from VS. No matter what I try I get error:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine
The 'Microsoft.ACE.OLEDB.16.0' provider is not registered on the local machine
Many recommend that I need to download the ACE 2016 distributable. But is it needed with MS Access 2021 installed?