views:

30

answers:

2

Hi!

I made a software with a MS Access database, stored in Program Files and i can't change data in this database because it's saved in Program Files. It's working in other locations, but I need the database in Program Files.

It says: "This database has been opened read-only."

Does anyone know how to solve this problem?

+2  A: 

By default, the programs folder is read-only for user-level logons. You don't say your version of Windows, but for Vista/Win7, this is a problem. You either have to set the shortcut for your application to run as administrator, or change the permissions on the folder to allow write access (you can't do this unless you turn off the Orwellian SIMPLE FILE SHARING).

While it's logical to think of an Access application as a program file, the Access model breaks that logical model, because it has to be writable. The only proper place for any Access app (since Windows 2000, in fact) is the folder the %AppData% environment variable points to.

David-W-Fenton
I understand now. From now on, everytime a make a setup kit, the application will be in program files, and the database in the Application data folder. Thanks
DaJackal
No, that's wrong. You can't put the Access application MDB/ACCDB in the programs folder, because the programs folder is Read-Only, and the front end MDB/ACCDB has to be writable. You have to put both the front end and back end files in the user's profile.
David-W-Fenton
+2  A: 

Use Inno Setup to create an install of your Access database file to, as David points out, the users Application Data folder. The Inno Setup Third-Party Files page is a list of very useful enhancements. I've been happily using the ISTools to help with creation of the installer. As you tagged your question with ms-access-2007 you can use the free Access runtime for the executable portion.

Sample inno script which checks to see if a version of Access is installed. If not it tells you to install a runtime version of Access. If installed then it continues to install your FE MDE and other assorted files.'

Sample inno script which "wraps" the package wizard install into a single .exe

Deploying updates to your software in a Runtime environment for Access 2007

Tony Toews