I’m using old DAO 3.6 to connect Access database (with mde extension). App works fine on XP and on Win7/Vista when UAC is low/disabled. But when UAC is on I get following error:
The Microsoft Jet database engine cannot open the file ‘C:\ProgramData\company\db.mde’. It is already opened exclusively by another user, or you need permission to view its data.
My code:
'Connect to Database
dbE = New DAO.DBEngine()
dbT = dbE.OpenDatabase(Environment.GetFolderPath(
Environment.SpecialFolder.CommonApplicationData) & "\company\db.mde")
By default, Access databases are opened read-write. Also by default, regular users don’t have write permissions on
C:\ProgramData. Since, when UAC is enabled, you are just a “regular user”, it won’t work. To fix this, you have the following options:or
C:\ProgramData\companyso that regular users may modify files.or
Open the database in shared read-only mode. That way, DAO does not require write permissions to the file (readonly), nor does it require permissions to create an ldb file (shared).