Results 1 to 15 of 15
  1. #1
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41

    laccdb lock retained after Access is closed?

    When I open the database it keeps repairing itself.



    I also received this message when I try to close the ms access.
    I am the only user.
    Click image for larger version. 

Name:	1.jpg 
Views:	28 
Size:	77.5 KB 
ID:	29488

    When I open the database.
    Click image for larger version. 

Name:	2.jpg 
Views:	28 
Size:	79.6 KB 
ID:	29489

    Please help here is my code.

    frmAdd
    Code:
    Option Compare Database
    Option Explicit
    Private Sub btnAdd_Exit(Cancel As Integer)
    Forms("frmMain").Requery
    End Sub
    
    
    Private Sub btnClose_Click()
    On Error GoTo Err_Catch
        Me.Undo
        DoCmd.Close
    btnClose_Click:
        Exit Sub
    Err_Catch:
        MsgBox Err.Description
        Resume btnClose_Click
    End Sub
    
    
    Private Sub CatergoryInfo_ID_NotInList(NewData As String, Response As Integer)
    On Error GoTo myError
        
        Dim rst As DAO.Recordset
            
        Set rst = CurrentDb.OpenRecordset("CatergoryInfo", dbOpenDynaset)
        
            If vbYes = MsgBox("Category is not in the list. Do you wish to add " _
                    & NewData & " as a new Category?", _
                    vbYesNo + vbInformation, _
                    "New Category") Then
                    
                rst.AddNew
                    rst!Category = NewData
                rst.Update
                
                Response = acDataErrAdded
                
            Else
            
                Response = acDataErrContinue
                
            End If
           
    leave:
    
    
        If Not rst Is Nothing Then
            rst.Close: Set rst = Nothing
        End If
        
        Exit Sub
        
    myError:
       
        MsgBox "Error " & Err.Number & ": " & Error$
        Resume leave
    End Sub
    
    
    
    
    Private Sub CompanyInfo_ID_Change()
    If IsNull(Me.CompanyInfo_ID.Value And Me.CountryInfo_ID.Value) Then
    btnAdd.Enabled = False
    Else
    btnAdd.Enabled = True
    End If
    End Sub
    
    
    Private Sub CompanyInfo_ID_LostFocus()
    If IsNull(Me.CompanyInfo_ID.Value And Me.CountryInfo_ID.Value) Then
    btnAdd.Enabled = False
    Else
    btnAdd.Enabled = True
    End If
    End Sub
    Private Sub CountryInfo_ID_Change()
    If IsNull(Me.CompanyInfo_ID.Value And Me.CountryInfo_ID.Value) Then
    btnAdd.Enabled = False
    Else
    btnAdd.Enabled = True
    End If
    End Sub
    
    
    Private Sub CountryInfo_ID_LostFocus()
    If IsNull(Me.CompanyInfo_ID.Value And Me.CountryInfo_ID.Value) Then
    btnAdd.Enabled = False
    Else
    btnAdd.Enabled = True
    End If
    End Sub
    
    
    Private Sub CompanyInfo_ID_NotInList(NewData As String, Response As Integer)
    On Error GoTo myError
        
        Dim rst As DAO.Recordset
            
        Set rst = CurrentDb.OpenRecordset("CompanyInfo", dbOpenDynaset)
        
            If vbYes = MsgBox("Company name is not in the list. Do you wish to add " _
                    & NewData & " as a new Company?", _
                    vbYesNo + vbInformation, _
                    "New Company") Then
                    
                rst.AddNew
                    rst!CompanyName = NewData
                rst.Update
                
                Response = acDataErrAdded
                
            Else
            
                Response = acDataErrContinue
                
            End If
           
    leave:
    
    
        If Not rst Is Nothing Then
            rst.Close: Set rst = Nothing
        End If
        
        Exit Sub
        
    myError:
       
        MsgBox "Error " & Err.Number & ": " & Error$
        Resume leave
    End Sub
    Private Sub Email_AfterUpdate()
    If IsNull(Me.Email.Value) Then
    Me.cmbEmailStatus.Value = Null
    Else
    Me.cmbEmailStatus.Value = "NEW"
    End If
    End Sub
    
    
    Private Sub Fax_BeforeUpdate(Cancel As Integer)
    Dim rslt As Integer
     
       If Nz(DLookup("[Fax]", "ContactDetails", "[Fax]='" & Me.Fax & "'"), 0) <> 0 Then
          rslt = MsgBox("This number has already been entered. Do you wish to continue?", vbYesNo)
          If rslt = vbNo Then
             Cancel = True
             'Me.Fax = Null
             'Me.Fax.SetFocus
          End If
       End If
    End Sub
    
    
    Private Sub Form_Load()
    DoCmd.GoToRecord , , acNewRec
    End Sub
    
    
    Private Sub Mobile_BeforeUpdate(Cancel As Integer)
    Dim rslt As Integer
     
       If Nz(DLookup("[Mobile]", "ContactDetails", "[Mobile]='" & Me.Mobile & "'"), 0) <> 0 Then
          rslt = MsgBox("This number has already been entered. Do you wish to continue?", vbYesNo)
          If rslt = vbNo Then
             Cancel = True
             'Me.Mobile = Null
             'Me.Mobile.SetFocus
          End If
       End If
    End Sub
    
    
    Private Sub PositionInfo_ID_NotInList(NewData As String, Response As Integer)
    On Error GoTo myError
        
        Dim rst As DAO.Recordset
            
        Set rst = CurrentDb.OpenRecordset("PositionInfo", dbOpenDynaset)
        
            If vbYes = MsgBox("Position is not in the list. Do you wish to add " _
                    & NewData & " as a new Position?", _
                    vbYesNo + vbInformation, _
                    "New Position") Then
                    
                rst.AddNew
                    rst!Position = NewData
                rst.Update
                
                Response = acDataErrAdded
                
            Else
            
                Response = acDataErrContinue
                
            End If
           
    leave:
    
    
        If Not rst Is Nothing Then
            rst.Close: Set rst = Nothing
        End If
        
        Exit Sub
        
    myError:
       
        MsgBox "Error " & Err.Number & ": " & Error$
        Resume leave
    End Sub
    
    
    Private Sub Telephone_BeforeUpdate(Cancel As Integer)
    Dim rslt As Integer
     
       If Nz(DLookup("[Telephone]", "ContactDetails", "[Telephone]='" & Me.Telephone & "'"), 0) <> 0 Then
          rslt = MsgBox("This number has already been entered. Do you wish to continue?", vbYesNo)
          If rslt = vbNo Then
             Cancel = True
             'Me.Telephone = Null
             'Me.Telephone.SetFocus
          End If
       End If
    End Sub
    frmMain
    Code:
    Option Compare Database
    Option Explicit
    
    
    Private Sub btnFind_Click()
    DoCmd.RunCommand acCmdFind
    End Sub
    
    
    Private Sub btnReset_Click()
    
    
        Me.FilterOn = False
     
    End Sub
    
    
    Private Sub Form_Load()
    'fMakeBackup
    Application.SetOption "Default Find/Replace Behavior", 1
    Me.FilterOn = False
    End Sub
    frmSearch
    Code:
    Option Compare Database
    Private Sub btnClear_Click()
    For Each ctl In Me.Controls
        Select Case ctl.ControlType
        Case acTextBox, acComboBox, acCheckBox ' adjust to taste
            'Debug.Print ctl.Name, Len(ctl.ControlSource)
            If Len(ctl.ControlSource) = 0 Then
                ctl.Value = Null
            End If
        Case Else
            ' pass
        End Select
    Next
    Forms("frmMain").FilterOn = False
    End Sub
    
    
    Private Sub btnClose_Click()
    On Error GoTo Err_Catch
        DoCmd.Close
    btnClose_Click:
        Exit Sub
    Err_Catch:
        MsgBox Err.Description
        Resume btnClose_Click
    End Sub
    
    
    Private Sub btnSearch_Click()
    If Not CurrentProject.AllForms("frmMain").IsLoaded Then
            DoCmd.OpenForm ("frmMain")
    End If
    
    
    '/////// PRIORITIES
    If Not IsNull(Me.cmbPriorities) Then
        Forms("frmMain").Filter = "[Priorities] Like " & Chr(34) & "*" & Me.cmbPriorities & "*" & Chr(34)
        Forms("frmMain").FilterOn = True
    End If
    '/////// FOLLOWUP
    If Not IsNull(Me.Followup) Then
        Forms("frmMain").Filter = "[Followup] = " & Me.Followup
        Forms("frmMain").FilterOn = True
    End If
    '/////// CLIENT
    If Not IsNull(Me.Client) Then
        Forms("frmMain").Filter = "[Client] = " & Me.Client
        Forms("frmMain").FilterOn = True
    End If
    '/////// COMPANY
    'If Not IsNull(Me.CompanyInfo_ID) Then
    '    Forms("frmMain").Filter = "[CompanyInfo_ID] Like " & Chr(34) & "*" & Me.CompanyInfo_ID & "*" & Chr(34)
    '   Forms("frmMain").FilterOn = True
    'End If
    '/////// CONTACT PERSON
    If Not IsNull(Me.ContactPerson) Then
        Forms("frmMain").Filter = "[ContactPerson] Like " & Chr(34) & "*" & Me.ContactPerson & "*" & Chr(34)
        Forms("frmMain").FilterOn = True
    End If
    '/////// STATUS
    If Not IsNull(Me.Status) Then
        Forms("frmMain").Filter = "[Status] = " & Chr(34) & Me.Status & Chr(34)
        Forms("frmMain").FilterOn = True
    End If
    '/////// EMAIL
    If Not IsNull(Me.Email) Then
        Forms("frmMain").Filter = "[Email] Like " & Chr(34) & "*" & Me.Email & "*" & Chr(34)
        Forms("frmMain").FilterOn = True
    End If
    '/////// REMARKS
    If Not IsNull(Me.Remarks) Then
        Forms("frmMain").Filter = "[Remarks] Like " & Chr(34) & "*" & Me.Remarks & "*" & Chr(34)
        Forms("frmMain").FilterOn = True
    End If
    '/////// CATEGORY
    If Not IsNull(Me.CatergoryInfo_ID) Then
        Forms("frmMain").Filter = "[CatergoryInfo_ID] = " & Me.CatergoryInfo_ID
        Forms("frmMain").FilterOn = True
    End If
    '/////// CITY
    If Not IsNull(Me.City) Then
        Forms("frmMain").Filter = "[Full Address] Like " & Chr(34) & "*" & Me.City & "*" & Chr(34)
        Forms("frmMain").FilterOn = True
    End If
    '/////// ADDRESS
    If Not IsNull(Me.Address) Then
        Forms("frmMain").Filter = "[Full Address] Like " & Chr(34) & "*" & Me.Address & "*" & Chr(34)
        Forms("frmMain").FilterOn = True
    End If
    '/////// COUNTRY
    If Not IsNull(Me.CountryInfo_ID) Then
        Forms("frmMain").Filter = "[CountryInfo_ID] = " & Me.CountryInfo_ID
        Forms("frmMain").FilterOn = True
    End If
    End Sub
    frmUpdate
    Code:
    Option Compare Database
    Option Explicit
    
    
    Private Sub btnClose_Click()
    On Error GoTo Err_Catch
        Me.Undo
        DoCmd.Close
    btnClose_Click:
        Exit Sub
    Err_Catch:
        MsgBox Err.Description
        Resume btnClose_Click
    End Sub
    
    
    Private Sub CatergoryInfo_ID_NotInList(NewData As String, Response As Integer)
    On Error GoTo myError
        
        Dim rst As DAO.Recordset
            
        Set rst = CurrentDb.OpenRecordset("CatergoryInfo", dbOpenDynaset)
        
            If vbYes = MsgBox("Category is not in the list. Do you wish to add " _
                    & NewData & " as a new Category?", _
                    vbYesNo + vbInformation, _
                    "New Category") Then
                    
                rst.AddNew
                    rst!Category = NewData
                rst.Update
                
                Response = acDataErrAdded
                
            Else
            
                Response = acDataErrContinue
                
            End If
           
    leave:
    
    
        If Not rst Is Nothing Then
            rst.Close: Set rst = Nothing
        End If
        
        Exit Sub
        
    myError:
       
        MsgBox "Error " & Err.Number & ": " & Error$
        Resume leave
    End Sub
    
    
    Private Sub CompanyInfo_ID_NotInList(NewData As String, Response As Integer)
    On Error GoTo myError
        
        Dim rst As DAO.Recordset
            
        Set rst = CurrentDb.OpenRecordset("CompanyInfo", dbOpenDynaset)
        
            If vbYes = MsgBox("Company name is not in the list. Do you wish to add " _
                    & NewData & " as a new Company?", _
                    vbYesNo + vbInformation, _
                    "New Company") Then
                    
                rst.AddNew
                    rst!CompanyName = NewData
                rst.Update
                
                Response = acDataErrAdded
                
            Else
            
                Response = acDataErrContinue
                
            End If
           
    leave:
    
    
        If Not rst Is Nothing Then
            rst.Close: Set rst = Nothing
        End If
        
        Exit Sub
        
    myError:
       
        MsgBox "Error " & Err.Number & ": " & Error$
        Resume leave
    End Sub
    
    
    Private Sub Email_AfterUpdate()
    If IsNull(Me.Email.Value) Then
    Me.cmbEmailStatus.Value = Null
    Else
    Me.cmbEmailStatus.Value = "NEW"
    End If
    End Sub
    
    
    Private Sub PositionInfo_ID_NotInList(NewData As String, Response As Integer)
    On Error GoTo myError
        
        Dim rst As DAO.Recordset
            
        Set rst = CurrentDb.OpenRecordset("PositionInfo", dbOpenDynaset)
        
            If vbYes = MsgBox("Position is not in the list. Do you wish to add " _
                    & NewData & " as a new Position?", _
                    vbYesNo + vbInformation, _
                    "New Position") Then
                    
                rst.AddNew
                    rst!Position = NewData
                rst.Update
                
                Response = acDataErrAdded
                
            Else
            
                Response = acDataErrContinue
                
            End If
           
    leave:
    
    
        If Not rst Is Nothing Then
            rst.Close: Set rst = Nothing
        End If
        
        Exit Sub
        
    myError:
       
        MsgBox "Error " & Err.Number & ": " & Error$
        Resume leave
    End Sub

  2. #2
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Sounds like you may have a corrupt DB. Open a new DB. Go to External Data, New Data Source, From DataBase, Access, Select your DataBase, Import, On each tab select All and then click ok. Your new db should be free of any corruption. Use the new DB and delete the Old one after testing to make sure it is viable.

  3. #3
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41
    Done, I will observe now and let you know.

    thank you.

  4. #4
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41
    Still happening It usually occurs after I update some data.

    Quote Originally Posted by alansidman View Post
    Sounds like you may have a corrupt DB. Open a new DB. Go to External Data, New Data Source, From DataBase, Access, Select your DataBase, Import, On each tab select All and then click ok. Your new db should be free of any corruption. Use the new DB and delete the Old one after testing to make sure it is viable.

  5. #5
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41
    Bump, help anyone?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41
    Quote Originally Posted by June7 View Post
    If you want to provide db for analysis, follow instructions at bottom of my post.
    Hi I already attached my ms access file. Thanks
    Attached Files Attached Files

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Opened db, added record into the form that opened, updated record, then close db. laccdb file gone
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41
    Quote Originally Posted by June7 View Post
    Opened db, added record into the form that opened, updated record, then close db. laccdb file gone
    It's not always happening.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    I did data entry/edit several times. If you can't identify circumstances (sequence of operations, particular data input, etc) that cause issue then can't replicate and can't offer a solution.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41
    Based on my observation It usually occurs when I am updating the database.

    Quote Originally Posted by June7 View Post
    I did data entry/edit several times. If you can't identify circumstances (sequence of operations, particular data input, etc) that cause issue then can't replicate and can't offer a solution.

  12. #12
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Look at this link and maybe this will help-->http://www.everythingaccess.com/tuto...ase-corruption

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    What do you mean by 'updating' - just editing a record? Did that. I could do data edits for forever and a day and still not encounter random issue. The db works. I cannot replicate issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    margzj is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Location
    Dubai
    Posts
    41
    Yes editing some records, maybe It has something to do with my records? because I just imported this one from an excel file.

    Quote Originally Posted by June7 View Post
    What do you mean by 'updating' - just editing a record? Did that. I could do data edits for forever and a day and still not encounter random issue. The db works. I cannot replicate issue.

  15. #15
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    I've seen this before (though that doesn't mean I have the correct answer this time). It was sometimes because the network wasn't refreshing fast enough and sometimes because the user had permissions to create or edit but not delete. If they cannot delete, the lock file remains.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. LACCDB file won't delete
    By ranman256 in forum Access
    Replies: 4
    Last Post: 05-17-2016, 08:10 AM
  2. Replies: 1
    Last Post: 12-05-2012, 07:03 PM
  3. Replies: 2
    Last Post: 09-14-2012, 04:40 PM
  4. *.laccdb file stuck
    By jessmith07 in forum Access
    Replies: 4
    Last Post: 03-16-2012, 08:32 AM
  5. Replies: 4
    Last Post: 08-17-2011, 05:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums