I built an Access database. It was originally meant to be for 6 people but I see that it's up to about 20, so that could be the problem. Anyway, the backend gets into an inconsistent state a couple of times a day. It is usually possible to resolve this by opening the backend at which point it offers to recover it and usually does so.

In response to a question in the comments: What happens is that the frontends are no longer able to read any of the tables in the backend and so throw an error.

When I open the back end is states the following:

MS Access Error

Microsoft Access has detected that this database is in an inconsistent state, and will attempt to recover the database. During this process, a backup copy of the database will be made and all recovered objects will be placed in a new database. Access will then open the new database. The names of objects that were not successfully recovered will be logged in the "Recovery Errors table.

The only option is to press "OK". Usually, this can be done in situ, but when I have been looking at the file on a VPN I sometimes find it spins for a little while. In that case, I can copy the inconsistent file to my harddrive, open it, press OK, and let it do its thing. It usually only takes a couple of seconds. At that point it says:

MS Access Recovered

Microsoft Access has recovered this database. Examine the database to verify that there are no missing database objects.

So far this has been successful apart from once when I had to go to a slightly older backup.

The database is not particularly complicated (I don't think) but it does have some VBA.

The basic idea of the database is that we are tracking lots that need to move through a set of processes but that get broken up. So we might receive 1000 items, and then have 300 of them go to prescreening, and later another 100, and so on through all the about 8 steps.

The way I've done this (which I'd be happy to change - I just don't know what to change) is to have a small submission table, which tracks the lots as they come in, and a larger table (called preorder for reasons which don't matter) which tracks the line items.

The preorder table has quite a large number of fields (about 75). But of importance to this is the quantity field and the status field. The status field tracks the items through the process (so from step 1=Receiving to 8=Shipping or whatever). The quantity tracks how many of this particular item there are from this batch with the other properties at this status.

Then there are forms for each of these steps with very similar VBA behind them. One of the fields will be basically "quantity to move to the next step" (this is one of the fields in the preorder table that is initially defaulted to 0). The user fills in this quantity (and some additional information potentially) and presses a button to process the step.

The VBA:

  1. opens a recordset (rs) for the preorder table where the status is 1 (say) and the quantity to go to the next step is >0.
  2. It also opens an appendonly recordset of the preorder table (rs2).
  3. Then it goes through the records in rs, adjusts the quantity down, and appends a new copy of the record with the new quantity and an updated status.

The below is an example from one of the screens. Others are similar, although there are some nuances baked in that may or may not be important.

Private Sub btnProcess_Click()
    DoCmd.Hourglass True
    Dim db As Database
    Dim rs As DAO.Recordset
    Dim rs2 As DAO.Recordset
    Set db = CurrentDb
    Set rs = db.OpenRecordset("SELECT * FROM tblPreorder " & _
                            "WHERE (((tblPreorder.StatusID)=1) AND ((tblPreorder.PSQuantity)>0));", dbOpenDynaset, dbFailOnError)
    If rs.EOF Then
        MsgBox "No records found for processing"
        DoCmd.Hourglass False
        Exit Sub
    End If
    Set rs2 = db.OpenRecordset("tblPreorder", dbOpenDynaset, dbAppendOnly)
    Do Until rs.EOF
        myQuantity = rs("Quantity").Value
        PSQuantity = rs("PSQuantity").Value
        For Each fld In rs.Fields
            SFld = fld.Name 'to catch special fields
            Select Case SFld
                'special cases
                Case "ID":  'do nothing
                Case "Quantity":
                    rs(SFld).Value = myQuantity - PSQuantity
                    rs2(SFld).Value = PSQuantity
                Case "Comment":
                    If Len(Trim(rs("PSComment")) > 0) Then
                        rs2(SFld).Value = Trim(rs("Comment")) & vbCrLf & Trim(rs("PSComment"))
                        rs2(SFld).Value = rs(SFld)
                    End If
                Case "StatusID":
                    rs2(SFld).Value = 2 'Changes the status from 1 to 2
                Case "DateChanged":
                    rs2(SFld).Value = Now()
                Case "EmployeeID":
                    rs2(SFld).Value = UserID()
                Case "Location":
                    If rs("PSLocation") <> "" Then
                        rs2(SFld).Value = rs("PSLocation")
                    End If
                Case "PSDate":
                    rs2(SFld).Value = Now()
                Case "PSEmployeeID":
                    rs2(SFld).Value = UserID()
                Case "PSQuantity":
                    rs(SFld) = 0
                    rs2(SFld) = 0
                Case "ReleasedFiles": 'do nothing
                Case Else:
                    rs2(SFld).Value = fld.Value
            End Select
        Next fld
    c = Me.CurrentRecord
On Error Resume Next:
    DoCmd.GoToRecord acDataForm, Me.Name, acGoTo, c
    MsgBox "Items moved to BNC Request"
    DoCmd.Hourglass False
End Sub

My questions:

  1. If you see anything obviously wrong, of course, let me know. It works like a charm when it's just me testing it. I've never managed to replicate the issue, but I can see that it's happening in the production version.
  2. I've followed the advice on a couple of websites on avoiding this (e.g. https://www.techrepublic.com/article/get-it-done-top-10-ways-to-prevent-access-database-corruption/). I'm basically tinkering and trying things because I don't fundamentally know what the issue is. E.g. I switched from recordset to DAO.recordset in the above code. It didn't seem to make a difference, so I might go back. Everyone is using Access 365 and the backend is Access 365 so it seemed to make sense to use an Access specific recordset. I close all the recordsets (rs.close); I compile the VBA; I have saved the frontend as an accde; All users use the accde from their own computers; All users are using wired connections; I have version control so everyone is using the latest frontend.
  3. The main question, I suppose: How can I diagnose this? I could easily imagine putting a new table in to track who's hitting the process button and when and which one. I'm probably going to do that to see what happens in the lead up to a corruption. But what are your recommendations for what to track and are there any other tricks and tips to get to the root of this?

Code specific questions:

  1. Recordset or DAO.Recordset or some other thing?
  2. dbFailOnError or dbSeeChanges or some other thing?
  3. rs.Edit ... rs.Update on the couple of fields that get updated as I loop (current code)? Or one rs.Edit ... rs.Update on either side of the loop?
  4. Should I be putting a manual hold or something to prevent people from running similar code simultaneously? It offends me a little to do so, since I kind of imagine that the people who make MS Access will do a better job than me at that sort of thing. But I could probably set a flag somewhere that literally makes people wait their turn. I'd still be worried about a race condition.

Wider database questions:

  1. Are there other secret settings that need to be adjusted to minimize this issue? Everyone is using MS Access 365. Name AutoCorrect Options, Filter lookup options, caching, data type support options. I don't really know what these do and I suspect there are gotchas everywhere! I had a similar database that I used for years without issue, so I was lulled into a false sense of security here.
  2. Have I structured this completely wrong? I'm okay to do a whole bunch of work - it would just be nice to have a good sense that it would solve the problem!
  • 1
    This question is a bit broad, but I don't think it's entirely off-topic. Just expect a few replies along the lines of "Access 2010 goes end of life next month." 😬 You'll probably get a few opinions on moving to a new version and/or different database engine. If you have technology restraints along those lines, it might be helpful up edit the question now to address it. (I'm no Access or VBA expert, so I'm no help to answer... Unless you're interested in moving to SQL Server.)
    – AMtwo
    Sep 5, 2020 at 19:45
  • Oh, I better double check. I think we're actually using 2019
    – Dr Xorile
    Sep 5, 2020 at 19:50
  • Oh, yeah, we're all on Office 365. I'll update
    – Dr Xorile
    Sep 6, 2020 at 19:02
  • 1
    the backend gets corrupted you should drive this more precisely. What errant behaviour do you see, error messages? if so what do they say? corrupt data in responses to queries? etc. it offers to fix it again stating exactly what messages you see could be helpful to know as they may be one of several issues that the messages will help wittle out of consideration. Sep 6, 2020 at 22:02
  • @DavidSpillett, thanks for your question. I've included screenshots and transcriptions of the inconsistent state and the recovery messages.
    – Dr Xorile
    Sep 6, 2020 at 22:24

1 Answer 1


It looks like this is a so far unfixed problem with Access

Microsoft document the following workaround :-

Click Windows Start Press the Windows key and then type Command. Right-click on Command Prompt and choose Run as administrator.

Copy and paste the following commands into the command prompt window:

REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters /v DisableLeasing /t REG_DWORD /d 1 /f



Close the command prompt window.

see https://support.microsoft.com/en-us/office/access-reports-that-databases-are-in-an-inconsistent-state-7ec975da-f7a9-4414-a306-d3a7c422dc1d

  • Thanks. This is super helpful. I'm checking with the client to see if this is possible.
    – Dr Xorile
    Sep 17, 2020 at 17:53
  • curious if this helped ? Sep 22, 2020 at 9:41
  • Me too! We've made a new server for this since we didn't want to risk causing other problems on their server, so the wheels are moving. I'll give feedback when I've heard
    – Dr Xorile
    Sep 22, 2020 at 13:03
  • Seems to be working more reliably. Client has been more hesitant to use it, so I don't have the same level of user activity as before. I'll update if there's an update - this optimism may be premature
    – Dr Xorile
    Nov 2, 2020 at 22:31
  • Yes, this seems to have fixed it. How insane that this is a thing. Luckily we're in a world of virtual servers, so this could be spun up relatively easily and without disrupting existing servers. Thank you so much for the link - I was tearing my hair out!
    – Dr Xorile
    Nov 10, 2020 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.