Database intermittently does not open on mouse click

But it should disappear on closing the database, right? But sometimes it stays open.
 
Office 365 - current update
1724862219220.png
 
there is nothing wrong with this .ldb file.
whether it is there or not, it is recreated everytime you open the db.

ArnelGP, I admit I'm splitting hairs here, but that is not necessarily true. The lock file is NOT recreated when you open the DB if it happens that the previous iteration of the DB didn't close correctly. And if a lock file happens to be SHARED at the time, a 2nd user doesn't recreate the shared lock file, they just open it. If the OTHER user of the lock file had a problem, that can leave the lock file unusable, thus blocking later instantiations of Access. The specific problem when that happens has to do with Windows having exclusive file locks on the Access lock file.

As to WHY the DB fails to close, there is a problem with ALL Windows tasks having to do with failure to close what you open. If the task is written correctly, it can go into I/O Rundown and shut down everything. But for Access there are exceptions.

@Sreemike - my question is, do you have ANY FORM in your DB has the ability to prevent a form from closing if it is currently dirty? Because something is stopping Access from closing and a form that has the ability to cancel a Close event would have that effect. That's not the only thing but it is the most likely thing.
 
No. I only have four forms. None has the ability to prevent another from closing. And this problem only happens sporadically.
 
None has the ability to prevent another from closing.

Not exactly what I asked. Does any form have the ability to prevent itself from closing? Not "prevent another form from closing."

This ability could be that the form has a Form_BeforeUpdate event handler with the possibility of setting the Cancel parameter to TRUE. It could also happen if you have a Form_Unload event that can set Cancel to TRUE. When trying to close a "dirty" form, you FIRST have to allow the form to update (so as to no longer be dirty). Then you have to unload the form. Both of those can be stopped, and that would prevent the Access app from closing normally.
 
I am a novice when it comes to VBA. I had constructed this basic database some 8 years ago without any use of VBA. That being said, I did incorporate just two VBA codes two years ago. I shall attach those here.
1724940825130.png


The main form is shown below:
1724941291294.png


Apologies if these aren't much help. At the moment, I am just deleting the temp file manually in order to enable normal opening by clicking. My Plan is to transfer the table, forms and queries to a new database, and see if the error reoccurs.
 

Attachments

  • 1724940919216.png
    1724940919216.png
    44.7 KB · Views: 35
Offhand, I don't see much there to cause the problem, but there is a tiny window of ambiguity that MIGHT cause an issue. I doubt it, but in an attempt to close off all potential holes,

In cmdClose_Click() you use DoCmd.Close with no parameters. This is probably not the problem but read the article linked here:


What gets closed by this is, by default, the active window - and when you leave the parameters blank, that is exactly what you will close. IF it ever happens that something else becomes the active window just at the wrong time, the situation could get seriously confused. If you added the three parameters, it would become

DoCmd.Close acForm, Me.Name, FALSE

Sometimes you can't use the text name of an object type, so if you get a compile error on that line, acForm happens to be equal to 2 and you can just use the number. This more explicit command would always and unequivocally close the form having that command button and code in it. I'm not saying what you did was wrong, because most of the time, you DO close the form in question. But this would plug a tiny hole.

After this, if the problem persists, it might be necessary to look into some of the settings in File >> Options >> Current Database (of which there are A LOT of options.) The other place to look isn't this form, but whether you have something defined as an opening macro or opening form. I would check for opening forms and macros first.
 
like i said, the slowness of ms access database opening very slow is not with ms access fault.
it has to do with your windows.
i am using windows 11 and sometimes ms access database opens very fast and most of the time
very slow.
 
like i said, the slowness of ms access database opening very slow is not with ms access fault.
it has to do with your windows.
i am using windows 11 and sometimes ms access database opens very fast and most of the time
very slow.
At least your database eventually open; not in my case. I don't even get the turning circle. In my case, something is preventing it from properly quitting the access app on Exit.
 
Earlier it was suggested that you use Windows Task Manager to verify that a copy of MSACCESS.EXE is active (which it would be, if Access had failed to close properly). IF you actually CAN verify that Access is still running, I can show you how to find out which files are still active for it. One of them might be the culprit. It's a long shot, but it might help you figure it out.

You said earlier you are on Win 11. If you are an administrator on the machine in question, you can use the Win Start key (lower left corner) and in the "program to run" text box control, start typing "Resource Monitor" (without the quotes). At some point you will be able to LAUNCH the Resource Monitor. Do so.

The display for RM has basically four main sections - CPU, Disk, Memory, and Network. For this investigation, you don't care at all about Memory and Network.

In the CPU section, you can use drag-n-drop on the edges of the display to make the working area large enough to see a few things. If you click in the "Image" column header, you can change it to sort by name. Scroll down and find MSACCESS.EXE if it is still there. (If Task Manager found it, Resource Monitor should find it too.) There is a column called PID (process ID). Find the PID of the Access task. Write it down. It is rarely more than a 4-digit number and quite often is only 3 digits.

Now use the mouse to shrink the CPU section and drag-n-drop the DISK section wide open. If you click in the PID column header for the disk section, RM will sort the process data numerically. Find the PID in the disk section that matches the Access PID you found in the CPU section. You will now see all of the files together that Access has open at the time. One of them is your culprit. (Maybe.) If you find it, it might trigger recognition about the way that file is handled.
 
You said earlier you are on Win 11. If you are an administrator on the machine in question, you can use the Win Start key (lower left corner) and in the "program to run" text box control, start typing "Resource Monitor" (without the quotes). At some point you will be able to LAUNCH the Resource Monitor. Do so.
I think resmon is what needs to be written there.

I am pretty sure the Access instance is running and OP has not gone through the list provided by the Task Manager, but I might be wrong. If I'm wrong, something weird is happening there. If so, routine testing must be done. Things like seeing if other file behave the same way, what happens with new files, what happens if everything is moved to another new file, what happens after compact and repair, etc...
 
Thank you all. I will try to see the next time I encounter this error.
 
think resmon is what needs to be written there.

Win 11 does "find as you type". I did exactly what I described three days ago when researching something else that was network related. Web references will appear under that text box on the left side of the page; a "run resource monitor" large icon appears to the right.

However, I fully concur with your second paragraph. If it isn't an orphaned copy of Access then something really strange IS going on.
 
Win 11 does "find as you type". I did exactly what I described three days ago when researching something else that was network related. Web references will appear under that text box on the left side of the page; a "run resource monitor" large icon appears to the right.
My bad, I thought you were describing the Run dialog
 

Users who are viewing this thread

Back
Top Bottom