Connect to Access 2016 database through OLEDB

I'm trying to make a simple connection to a microsoft access 2016 database through a vb.net code, it's very simple:

Cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Data\VBtest\ConnectigToSecuredAccessDB\Production3.accdb; Jet OLEDB:Database Password=aros20;"

The database was encrypted using MS Access 2016, when I run the code I get the following error message:

"An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll

Additional information: Cannot open database ''. It may not be a database that your application recognizes, or the file may be corrupt".

When I decrypt the same database and use it with the connection string:
Cn.ConnectionString = "PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source = D:\Data\VBtest\ConnectigToSecuredAccessDB\Production.accdb"

it works fine which means the database is OK and the problem is in the encryption. What could the problem be? I'm confused.
Encryption of the database is very important and I need it.
Many thanks for your help.

1 answer

I had the exact same problem: Database working without password protection, OleDbException as soon as I put on a password. Now I'm not exactly sure what I did, suddenly it worked. Installing the 2010 AccessDatabaseEngine might have been the key, but now I'm not able to verify. I hope you find out!