Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't have exclusive access to database and so cannot save changes

Tags:

ms-access

I'm working on a MS Access database. I've made some changes to one of the modules. I want to go out for lunch, but when I try closing the database, I get the following message:

"You do not have exclusive access to the database. Your design changes cannot be saved at this time. Do you want to close without saving your changes?"

I'm pretty sure nobody else on the network has the database file open, and I don't have any other Access databases open. I'm probably missing something obvious, but would really appreciated some help!

Update:

In the end I copied all the code, closed the database without saving, re-opened it and pasted the code back in. I was then able to save the database. I'm not sure if this was a one off, but I'll report back if it happens again.

like image 271
inglesp Avatar asked Sep 26 '08 00:09

inglesp


People also ask

What do you use to open a database with exclusive Access?

in the top left of the Access window and then click on the Open option. Select the database that you wish to open exclusively. Click on the arrow to the right side of the Open button. A list of options will appear (Open, Open Read-Only, Open Exclusive, Open Exclusive Read-Only).

What is exclusive mode in database?

Exclusive Mode If the first instance that mounts a database does so in exclusive mode, only that instance can mount the database. Versions of Oracle that do not support the Parallel Server option only allow an instance to mount a database in exclusive mode.


2 Answers

If you're sure no one else is in the db but you, it's an additional connection to your db from your own pc. You can verify this with the LDB viewer, downloadable in the free JetUtils.exe download from Microsoft:

http://support.microsoft.com/kb/176670

Look through your code and check if you have two separate database objects in the default workspace or another database object in a separate workspace. That will cause this problem.

To fix it, make sure the database objects are set to nothing before they go out of scope, and if you opened the database object in code, you also need to close it before setting the database object to nothing.

like image 168
Chris OC Avatar answered Sep 29 '22 03:09

Chris OC


If you close the database and are sure nobody else has it opened, check to see if there is a .ldb file (it will have the same name as your database file). If the file is there, then there is a good chance it is still in use. Is it being access by a service, like a website?

You could copy the database to another sub-directory and make your changes. If that doesn't work, I will have to look that up. Of course there is always the database tool, "repair and compress database..."

Is the file located on a file server? If so check to see if any users have a file handle to it.

If it still doesn't work, update your post with your new information and we'll go further.

UPDATE (9/26): Another thing I do when having strange issues with access databases with contain vba code is decompile. I don't know if this is documented yet, I haven't looked in years, but it's was (at least) an undocumented switch to msaccess.

From a cmd line:

change directory to where msaccess.exe is located.
Run the following command

msaccess \path to access file\databasefile.mdb /decompile

usually runs very quick then opens the database. Open any module and compile.
Doesn't always work, but sometimes can remove strange happenings.

Did you ever trying to copy the database to another directory and making your edits? That should of worked; you could then rename the original and copy the file back.
Anyway, I am glad you are working again.

like image 30
Brettski Avatar answered Sep 29 '22 01:09

Brettski