Windows 7 Pro, Access 2010 .laccdb file does not clear when all users exit, so I cannot import modules or compact/repair

Rebooted my computer.  Tried deleting the file.  Tried renaming the file.  Still won't clear.   This has happened before, and cleared over time due to ??? action.  I'd like to know if I can clear it directly by some means.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert ShermanOwnerCommented:
When you say it "won't clear" do you mean you can not delete the file?

EDIT: Also, is the file stored on a local hard drive or is it on a network share?
Two possibilities.
1. Someone didn't close the database correctly.  This happens if they simply powered off or perhaps left it open and the network disconnected automatically.
2. Not everyone has delete permissions on the database so that it is random who is the last person to log off and if that person has delete permission, the lock file is deleted.  If they don't, it stays.

You can attempt to delete the lock file yourself but if Access thinks that someone still has the database open, it won't let you delete the lock file.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
" Someone didn't close the database correctly."
To elaborate more ... Access.EXE may be stuck in memory (not visible to user) ... and thus the Lock file will not and cannot be deleted.
Have all users reboot their systems to the Windows log in screen - and usually - this clears out the lock file.
Need More Insight Into What’s Killing Your Network

Flow data analysis from SolarWinds NetFlow Traffic Analyzer (NTA), along with Network Performance Monitor (NPM), can give you deeper visibility into your network’s traffic.

Robert ShermanOwnerCommented:
"Have all users reboot their systems to the Windows log in screen - and usually - this clears out the lock file. "

EXCEPT when the problem is #2 in @PatHartman 's answer.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David_W_RAuthor Commented:
Yes, it won't delete the file, and I can't delete it (on a network share).
Re: delete permissions - this has happened only twice in the past year, so this cause doesn't seem likely.
I'll have all users reboot and see what happens.
Dale FyeOwner, Developing Solutions LLCCommented:
You might want to try running the following code and pointing it to the Backend file (not the laccdb).  This will print in the immediate window the computers that are engaged in the lock on that file (including the computer you are running it from).
Sub LDBViewer2010()
'Reference Microsoft ActiveX Data Objects for this code to work

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Const conDatabase as String = "c:\sample.accdb"

    ' Open connection to Access backend
   cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & conDatabase & ";Persist Security Info=False;"

    ' Open recordset
   Set rs = cn.OpenSchema(adSchemaProviderSpecific, , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

    'Output the field list
   Debug.Print rs.Fields(0).Name, "|", rs.Fields(1).Name, "|", rs.Fields(2).Name, "|", rs.Fields(3).Name

    'Loop through users recordset of users in database.
   While Not rs.EOF
        Debug.Print Trim(rs.Fields(0)), "|", Trim(rs.Fields(1)), "|", Trim(rs.Fields(2)), "|", Trim(rs.Fields(3))

    ' Close
   If rs.State <> adStateClosed Then rs.Close
    Set rs = Nothing
    Set cn = Nothing
End Sub

Open in new window

This should help you identify who has the file locked.  If not, give the computer name to someone in IT, they should be able to tell you who has it locked.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"this has happened only twice in the past year"

EXCEPT ... if users did not have Full Permissions already, then this issue would be ongoing ....
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Yes, it won't delete the file, and I can't delete it (on a network share).>>

 You need to reboot the server (the machine that physically has the file), or clear the lock on the file handle manually.

 The last can be done through the File Services role on the server.  There you can kill the session that is holding the file open.   This avoids a reboot on the server.

 If Access however is running on the server itself, then closing the file handle manually is a little tougher (you need to use something process explorer from sys internals).

 A reboot is sure fire, but not everyone can reboot a server at will.

David_W_RAuthor Commented:
Thanks all.  Very helpful information to prevent future stalls in the system.  Turned out it was an infrequently used workstation with the db open.  Sorry for the delay.  Just returned to the office today.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.