Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database.ldb file cannot be deleted 1

Status
Not open for further replies.

franksirvent

Programmer
Mar 8, 2002
358
GB
Hi
I want to delete an .ldb file which is open (but in fact is not).
My PC crashed and had to restart it...now it has that file there and doesn't allow me to delete it.

It says that there it is in use...
I have tried to open it as Exclusive user but it doesn't let me for same reason.

I have turned off and on the PC twice already and the problem still there...

Any ideas....
 
I had a similar problem once, only I didn't intend to delete that file(don't think you can or are supposed to). I wanted to work on some tables but coudn't access it. As far as I understand, that file indicates that someone (who could be anyone) is logged in to the database. Is this database located on YOUR pc or on a different PC maybe a server and is it shared by other users? If not then I am unable and/or too much of a novice to give advice in this regard. Anyway, my problem started out when a database session was maliciously ended by a system crash from an administrator's pc, it was only resolved once the server was rebooted.
 
franksirvent

If the file is on your local desktop, you should be able to delete it after rebooting. If the file is on the server, you may have to wait until the server is rebooted.

Why? Files keep various "flags" on their status, type, etc. One flag is if a file is open. If the file is open, then you can not delete it, or rename it. "File in use..."

As part of the reboot process, the operating system will ensure all files are flagged as closed.

And deleting the LDB will not harm your application, and yes, the "system" normally does look after the LDB file - create, update, delete. Look at the directory after everyone is logged out of the application -- there should be no LDB file. ...But because you exited ungracefully, the system did not get a chance to update the LDB file.

Richard
 
If the LDB is on a server:

right click on the LDB file.
select open with
choose select program from a list
choose Notepad



This will show you who has flags open for your db
-----------------------



Some people make things happen, some watch while things happen, and some wonder 'What happened?'
 
thank you all for your help/responses.
BSando, how easy can that be? I had never even tried to read the file!!! You are right, it shows all the people in the database!!!
All I had to do was to close the program on the PC who showed up on the .ldb and, voila!, .ldb dissapeared !!!!

At first I didn't think that PC was logged on (the person is on holidays) so I didn't even check, but some other user had used the PC, this is the reason for the existence of the .ldb file.

Thanks again to all for your comments!



 
Frank,

I suggest you add an on timer event that quits the application after a specified amount of inactivity.

Not sure who wrote this code so I cannot credit them for it. I probably got it from somewhere on this site. Thanks for whoever wrote this:

Private Sub Form_Timer()
On Error Resume Next
' IDLEMINUTES determines how much idle time to wait for before running the IdleTimeDetected subroutine
Const IDLEMINUTES = 1
Static PrevControlName As String
Static PrevFormName As String
Static ExpiredTime
Dim ActiveFormName As String
Dim ActiveControlName As String
Dim ExpiredMinutes

' Get the active form and control name.
ActiveFormName = Screen.ActiveForm.Name
If Err Then
ActiveFormName = "No Active Form"
Err = 0
End If

ActiveControlName = Screen.ActiveControl.Name
If Err Then
ActiveControlName = "No Active Control"
Err = 0
End If

' Record the current active names and reset ExpiredTime if:
' 1. They have not been recorded yet (code is running for the first time).
' 2. The previous names are different than the current ones (the user has done something different during the timer interval).
If (PrevControlName = "") Or (PrevFormName = "") Or (ActiveFormName <> PrevFormName) Or (ActiveControlName <> PrevControlName) Then
PrevControlName = ActiveControlName
PrevFormName = ActiveFormName
ExpiredTime = 0
Else
' ... otherwise the user was idle during the time interval, so increment the total expired time.
ExpiredTime = ExpiredTime + Me.TimerInterval
End If

' Does the total expired time exceed the IDLEMINUTES?
ExpiredMinutes = (ExpiredTime / 1000) / 60
If ExpiredMinutes >= IDLEMINUTES Then

'.... if so, then reset the expired time to zero ...
ExpiredTime = 0
'.... and quit the application
Application.Quit acQuitSaveAll
End If
End Sub
Private Sub Command69_Click()
On Error GoTo Err_Command69_Click

Dim stDocName As String

stDocName = "rptReviewFinal"
DoCmd.OpenReport stDocName, acNormal

Exit_Command69_Click:
Exit Sub

Err_Command69_Click:
MsgBox Err.Description
Resume Exit_Command69_Click

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top