Microsoft Access Query is Corrupt (Error 3340)

Critical Alert

A set of Microsoft Office security updates released on November 12, 2019 causes Access databases to fail when it runs Update Queries to modify data. An error like this appears when the query is run:

Error 3340: “Query ‘qryName’ is corrupt”.

It doesn’t matter if the query is against a table in the current database, a linked table, or a linked SQL Server table. If the Access database engine is processing the UPDATE query, the error occurs.

In addition to Microsoft Access, other programs that update Access databases may also be affected. That includes Excel, PowerPoint, Word, etc. and programs written in Visual Studio .NET, VB6, and web applications.

Types of Update Queries Affected

When attempting to run an Update query, it may fail with the error: “Query ‘query name’ is corrupt”. This occurs for an UPDATE query that:

  • Updates a single table (i.e. it updates a table, rather than the output of a Select query or join)
  • Specifies a WHERE clause (i.e. has entries in the Criteria row in the query designer)

These queries can be saved Access query objects or SQL strings executed in VBA code (or other languages that use ACE).

Security Updates Causing Query is Corrupt Error 3340

The issue was introduced on November 12, 2019 via the following patch updates for MSI builds:

  • Office 2010: Description of the security update for Office 2010: November 12, 2019 (KB4484127)
  • Office 2013: Description of the security update for Office 2013: November 12, 2019 (KB4484119)
  • Office 2016: Description of the security update for Office 2016: November 12, 2019 (KB4484113)
  • Office 2016: Update for Office 2016 – November 12, 2019 (KB3085368)

Microsoft announced they’ll fix this in the December update, but that’s way too long to wait. We hope Microsoft will respond more quickly. Until then, we found multiple solutions to address this issue.

Current Microsoft Fixes

Here are the current Microsoft fixes for the issue.

  • Access 2010 MSI, Access Database Engine 2010 Redistributable: Fixed Build 7241.5001 – November 27, 2019
    This update is only available for manual download and installation from the Microsoft Download Center.
    To manually download the update, visit November 27, 2019, update for Office 2010 (KB2986256).
    Organizations that want to distribute the update without requiring each user to install manually, visit Distribute product updates for Office 2010 for more information.
  • Access 2013 MSI: Fixed Build 5189.1002 – November 27, 2019
    This update is only available for manual download and installation from the Microsoft Download Center.
    The update can’t be installed on Office Home and Student 2013 RT.
    To manually download the update, visit November 27, 2019, update for Office 2013 (KB2965317).
    Organizations that want to distribute the update without requiring each user to install manually, visit Distribute updates for Office 2013 products for more information.
  • Access 2016 MSI, Access Database Engine 2016 Redistributable: Fixed Build 4927.1002 – November 18, 2019
    This update is only available for manual download and installation from the Microsoft Download Center.
    To manually download the update, visit November 18, 2019, update for Office 2016 (KB4484198).
  • Access O365 Monthly Channel/Access 2016 C2R/Access 2019 (Version 1910): Fixed Build 12130.20390 – November 18, 2019
    Open an Office program, select [File], click [Account], click [Update Options] and select [Update Now].
    For more information on the update, visit Version 1910: November 18.
  • Access for Office 365 (Microsoft Store Version): Fixed Build 12130.20390 – November 22, 2019
    Open Microsoft Store, Click on […] in the upper right corner, Choose [Downloads and Updates]
  • Access for O365 Semi-Annual (Version 1808): Fixed Build 10730.20422 – November 22, 2019
    Open an Office program, select [File], click [Account], click [Update Options] and select [Update Now].
    For more information on the update, visit Version 1808: November 22.
  • Access for O365 Semi-Annual (Version 1902): Fixed Build 11328.20480 – November 22, 2019
    Open an Office program, select [File], click [Account], click [Update Options] and select [Update Now].
    For more information on the update, visit Version 1902: November 22.
  • Access for O365 Semi-Annual (Version 1908): Fixed Build 11929.20494 – November 22, 2019
    Open an Office program, select [File], click [Account], click [Update Options] and select [Update Now].

Future Microsoft Fixes (Estimated Availability Date)

  • Access 2010 C2R: Fixed Build TBD – December 10, 2019
    Open an Office program, select [File], click [Account], click [Update Options] and select [Update Now].
  • Access 2013 C2R: Fixed Build 5197.1000 – December 10, 2019
    Open an Office program, select [File], click [Account], click [Update Options] and select [Update Now].
  • Access 2019 Volume License: Fixed Build TBD – December 10, 2019
    Open an Office program, select [File], click [Account], click [Update Options] and select [Update Now].

Solutions

  1. Uninstall the Security Updates
    • The best way to fix the problem is to uninstall the Security update for Office which is the source of the problem. There are different steps depending on whether you are on an Office 365 subscription or not.
  2. Modify All Your Update Queries
    • If your solutions are deployed to users where you cannot uninstall their Security Updates, you can modify your queries so they don’t trigger the problem. This can be done by adjusting the queries or replacing them with recordsets updated in code.
  3. Rename each table and create a query selecting it with the original table name. Need to adjust table references.
  4. Deploy your Access application with Access 2007 or earlier. You can download the free Access 2007 runtime from our site.

For detailed information and step-by-step instructions, visit Microsoft Access Error 3340: Query is Corrupt.

48 thoughts on “Microsoft Access Query is Corrupt (Error 3340)

  1. Please be advised that on some installations with Microsoft Office 2016 KB4484113 may be missing in the list of installed updates. In that case be on the lookout for KB3085368 that might have replaced KB4484113. That is if you want to resolve the problem by uninstalling the security updates. If you choose to uninstall KB3085368, KB4484113 might appear in the list of installed updates. You have then to uninstall that, too to get rid of Error 3340.

  2. Sudenly there were over 180 emails on my inbox and over 100 textmsg and over 75 calls on my phone..
    YES.. the access app failed and my clients cannot process payroll and over 18k employees were not going to receive their payroll WHAT?

    Yes, the worst nightmare.. thanks to Mr Luke Chung documented steps step i was able to fix the instalation for the first 5 customers and then my support team rolled out a solution for all customers.. some customers also were fixed by just removing the runtime and reinstall the latest version of the runtime.. only a few used the nov-18 update fix.

  3. Office 2016 (32 bit) local installation. Windows 7 and Windows 10 mix.
    Error 3340 with either OS.
    Looking at the update installation list and there are – NO – Office updates installed, just Windows updates.
    The worst of it is that this error appeared on one computer (Windows 10) in the morning and by the afternoon 3 more Windows 10 computers had the same error message and one Widows 7 computer. None of these computers had any Office update installed.

    • To follow up on my first post:
      I checked two computers that are affected by error 3340 and there are – NO – office updates installed on either computer. The only common updates are the following Windows updates:
      KB4524569 installed on November 13, 2019
      KB4519573 installed on November 16, 2019

      The computers have Office 2016 installed. I ran the manual update patch and the msgbox stated there was no update to roll back.

      Any suggestions would be greatly appreciated

      • Hi
        I have the same problem with Access 2013 installed…

        OTHER PROBLEMS ARE :
        If you use attached tables (not tested in local tables) and use bddata as the connected database instance
        bddata.openrecordset(“tblname”, dbopentable) return error 3219 “invalid operation”
        AND
        set Tbl = bddata.openrecordset(“tblname”)
        Tbl.index=”PrimaryKey” return another error

  4. Note that it also affected run-time versions of Access. I had a client with Access 2010 run-time who was affected.

    Note also that windows updates appear to only affect the highest version of Office installed, so if you have (say) 2016 then installing and using (say) 2010 run-time might be another work-around option – if the database works with the earlier version.

  5. In addition to the fix for Office 2016 MSI installations, the fix is now available for O365 Monthly Channel, and Office 2016 C2R users. To get an immediate update for these installations, use Fiile/Account/UpdateOptions/UpdateNow.

  6. What an incredible pain in the butt. I just spent a couple of hours implementing your suggested changes on updating the query instead of the table. It works. Hundreds of changes. Thank you.
    I found sometimes the “corrupt” query occurs and sometimes it does not.
    I was trying to figure out how to use your system with a linked query update and decided to try the update without making your suggested change – it worked. Go figure.
    If I find a linked query update that does not work – how would I fix it?

    strSQL = “UPDATE zt2 INNER JOIN zt1 ON (zt1.Date = zt2.Date) ” & _
    “AND (zt2.IDSheet = zt1.IDSheet) AND ” & _
    “(zt2.Activity = zt1.Activity) ” & _
    “SET zt2.Dummy = ‘Z’;”
    DoCmd.RunSQL strSQL

    If you hear anything else from Microsoft – please let me know
    Thanks

    • VBA queries with ONLY a single table will fail.
      Your example has a join and so should not fail.
      If you have a failed query in VBA, go from

      UPDATE ‘whatever table selection failed’ … to
      UPDATE (select * from whatever table selection failed)…

  7. Great article Luke. It is crazy that this happened. You did a great job of bringing all the various solutions together in a concise article. I have the 365 rollback to 4 steps.

  8. Thanks Luke for speedily assessing the problem and sharing the details with the community.
    How to avoid this in the future? Security patches seen as urgent so they roll out so fast not enough testing is done?
    Is it just too complex today to anticipate all the different components that could break and all the different application-side actions that would need to be tested?

  9. Thanks for your positive feedback. I’m very glad my team was able to diagnose the problem and come up with several solutions. Microsoft has begun to release some patches to address this but it’s still a manual process.

    In the meantime, we’ll be recommending the use of Group Policies to delay the installation of patches from the default Tuesday morning. so that one can monitor problems with the Tuesday patch and turn off updates should a serious problem arise. More on that later.

  10. I was hit by dozens of client software crashes over the last 8 days.
    I wish that your post was easier to find on 11/13/2019.

    Considering FMSINC’s customer base, I would ask that you provide more information regarding how 201/2013/2016 runtime versions of Access are affected by the updates and the current and pending fixes.

    Microsoft has created a huge problem with all of their MSI, Click-to-Run, Office 365, runtime, 32-bit, and 64-bit versions of Access. There appears to be very little difference in important features between 2010/2013/2016/2019 versions of Access.

    One my biggest nightmares has been dealing with pre-installed trial copies of Office 365 that comes on so many new computers. We may to get customers to uninstall the Trail Version, or uninstall 64-bit Office 365 and then reinstall 32-bit Office 365. Sometime Office 365 does not uninstall so easy. Sometimes uninstalling Office 365 will leave garbage in the Windows registry that prevents installation of Access run-time.

    SageKey gave up on supporting their Installer earlier this year because of all of the complexities and grief caused by Microsoft’ and their support for Access.

    For more than 15 years Microsoft has gone to great lengths to disable old legacy Access 97 applications either through arrogance or incompetence – take your pick. More than 15 years ago, Sagekey ended up renaming the Access runtime exe so that future installations/updates of office would not immediately disable millions of Access 97 applications. Windows 10 finally pushed a lot of Access 97 holdouts to finally move on to newer versions of Access. I am glad i waited because: 1) I did not have to change 50,000 lines of code to support ADO over DAO, 2) I ended up finding a better Installer than Sagekey (SSESETUP.COM) 3) I ended up with a lot less customers running Access 2010+ when Microsoft dropped the KB4484119 and KB4484113 Security Patches for Access on 11/12/2019.

    • Thanks for your feedback. The runtime versions are identical to the retail versions and subject to the same Office updates. They are basically crippled versions of the retail versions.

  11. rs.update also affected. Changing source from table to query in SQL command also giving “query corrupt” error.
    Anyone has any workaround for recordset update??

    • Was the underlying table a local Access table, a linked Access table, a linked SQL Server table, or something else? And are you using DAO or ADO?

  12. Even though I have uninstalled KB4484113 (my application uses Access Runtime 2013), which fixed the corrupt query problem, I am now experiencing Error 3800 “fld1ANDfld2ANDfld3” is not an index. This is on code that has not changed for many months, is a compiled executable (.mde), and is executed by Access Runtime 2013. Any knowledge of what may be causing this?

      • Yes, I know the table and where it is located. The table has not been corrupted. I have verified this by other simple queries etc. Is it possible that the update in question (KB4484119) also updated some Registry value that uninstalling does not restore to its original value? Just wondering? Perhaps I should wait until the correction update is released before attempting to diagnose this further?

  13. Thank you for your bulletin on the Error 3390 problem. It saved me and some of my clients some hassle by disabling Office Updates for the duration of the problem.

    However one of my clients was not so lucky and got hit by the error. I applied the recommended rollback to build 12130.20272 using the Office Deployment Tool (ODT)which worked to resolve the issue.

    However after the fixed release of Build 12130.20390 I tried to enable Office Updates and found that it was “stuck” on the previous version.

    Looking at the documentation of the ODT I could find no method of reverting to using automatic updates. The documentation all assumes that having taken control of Office Updates you want to stay in control. But I want to simply revert to automatic updates on the monthly channel.

    Eventually I found that there is a registry value which sets the target version. I assume that this was set by the ODT. If the value is removed from the registry then Office Updates revert to downloading and installing the latest version.

    The value to remove is as follows:

    Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration
    Value: UpdateToVersion

    I hope that this helps anyone else that does want to be tied to using the ODT or Group Policy and simply wants to revert to automatic updates.

    Neil Sargent
    Smart IT Ltd
    United Kingdom

  14. Initiating an Office Update by using: File/Account/Update Options/Update Now has now resolved the error for all installations of Access 2016 and 365 that I know about. It looks like the fix should be available today for 2010 and 2013, but is anyone able to confirm this? I do not want to risk users who have disabled Office Updates for these versions.

    Many Thanks
    David Nye
    UK

  15. VBA will fail

    Dim SQL as string
    SQL = “UPDATE Sometable SET SomeField = SomeValue where SomeConstraint = Something”
    DoCmd.RunSQL SQL

    will fail

    Dim SQL as string
    SQL = “UPDATE (select * from Sometable) SET SomeField = SomeValue where SomeConstraint = Something”
    DoCmd.RunSQL SQL

    will succeed

  16. Thank you so much, would have been a considerable amount of time to rework all of the queries as indicated in the alternative approach.

  17. I fail to understand how MS could continue to inflict this update on users well after the time this issue was reported. In my case this hit me on Friday November 22.

    According to MS the fix to my channel will not be available until December 10

    To resolve my issue I followed the guide to using using the Office Deployment Tool to reinstall an earlier version of Office at
    https://support.microsoft.com/en-us/help/2770432/how-to-revert-to-an-earlier-version-of-office-2013-or-office-2016-clic
    but there was no clear indication as to which version I should roll back to …

  18. MSFT Web indicates the fixes are all complete and available. I have W10, with O365 12130.20390 installed, which is said to be the fixed version for this issue. And after testing, the issue is indeed fixed for my application. So, I am grateful for that. However, FMS Total Visual Agent 2016 is not working now and continues to get the error this message indicates. I have tested multiple apps that use the methods that would cause the issue to occur prior to the MSFT fix, and they all work, but my installation of the FMS Agent fails under the Monitor and Service functions. Can you help?

    • Unfortunately, our Total Visual Agent program has update queries that are impacted by the Security Update. Have you applied the fixes to remove the Microsoft updates on the machine that’s running Total Visual Agent? If so, that should allow Total Visual Agent to work again.

  19. How to I code around this?

    Dim StrSQL As String
    StrSQL = “UPDATE ” & tbl & _
    ” SET Valid = 0″ & _
    ” WHERE ClockID = ‘” & NetUserName & “‘”
    CurrentDb.Execute (StrSQL)

  20. I have Microsoft Office Professional Plus 2013 and the current version is 15.0.5189.1000. I suspect that this version is causing my Query is Corrupt Error 3340. When I view the installed updates I find no KB4484119. So I have nothing that I know of to uninstall.

    Suggestions, please

    Thanks

    Wes Jan

  21. Hello – the update for Office 2016 (KB4484198) worked for my full Office Access 2016 install, and on the Citrix server we ran it on, but it did not work on a pc that only had the Access 2016 runtime. I’ve read several articles on this problem, and I can see there is a distinction between MSI and C2R. Is the runtime version considered C2R, or is there a separate patch for the runtime?

    • As the Runtime is essentially a limited version of Microsoft Access, with the design functionality removed, there is no difference between full Access 2016 an runtime in regard to KB4484198. The problem with the ACE is fixed with that update. So everything should work again. Are you sure that it is Access 2016 runtime, that is installed and not Access 2019 runtime (or any other version than 2016)? The latter can only be installed on machines with C2R Office installations (aka Office 365) if I am not mistaken.

  22. Thank you. Worked like a charm on the first try. I thought I was crazy when queries that have worked for years suddenly were “corrupt.”

  23. Hello
    Other errors in access application that are running from up to 10 years:

    db.openrecordset(“tblname”, dbopentable) ERROR 3219… (if tblname is linked, not for local tables)

    set tbl=db.openrecordset(“tblname”)
    tbl.index=”primarykey” ERROR 3251… not allowed for this type of object

    These syntax where running correctly before 2019-11-12…
    Thank $soft

  24. Try to uninstall the last windows update.
    It work on our production computer by not on mine (which is my develpment computer…). Update query worked fine before 13th november…
    I tried to uninstall all windows update until 13th nov. Ok but I am not able to uninstall KB4523204…. and update query not not work anymore….
    Do anyone have an idea to solve it?

  25. Boa noite
    Aconselho a não alterar as tabelas nem consultas, use apenas o meu código e adapte a chamada de execução
    Sub UPDATE(strNomeTab As String, strInstrucaoSET As String, Optional MostraQtAlterados As Boolean = False)
    ‘————————————————————–‘
    ‘ código criado por Alexandre Neves, do Fórum MaximoAccess ‘
    ‘ utilize o código livremente mas mantenha os créditos ‘
    ‘————————————————————–‘
    ‘Exemplo com opção de mostrar quantidade de registos afectados
    ‘Call UPDATE(“Tabela”,”Campo=X”,True) em vez de UPDATE Tabela SET Campo=X
    ‘Exemplo com opção de mostrar quantidade de registos afectados
    ‘Call UPDATE(“Tabela”,”Campo=X”) em vez de UPDATE Tabela SET Campo=X
    Dim qdf As QueryDef
    Set qdf = CurrentDb.CreateQueryDef(“qdf” & strNomeTab, “SELECT * FROM ” & strNomeTab)
    If MostraQtAlterados Then
    With CurrentDb
    .Execute “UPDATE qdf” & strNomeTab & ” SET ” & strInstrucaoSET
    MsgBox .RecordsAffected
    End With
    Else
    CurrentDb.Execute “UPDATE qdf” & strNomeTab & ” SET ” & strInstrucaoSET
    End If
    CurrentDb.Execute “DROP TABLE qdf” & strNomeTab
    End Sub

  26. Top post! First search result and already found my solution. Manual update of O365 to Version 1902 Fixed Build 11328.20480. Should have immediatly thought of that. Never trust MS 🙂
    thanks

  27. This may have already been posted, but, my problem code:
    UPDATE table x SET fieldy = 0
    Resolved with:
    UPDATE (SELECT * FROM table x) SET fieldy = 0

  28. ADODB update calls also seem to be affected. On my Access 2019 installations that have the security update applied, attempts to execute rst.Update when any fields were modified fails with a “Query ” is corrupt” message only when the recordset’s CursorLocation property is set to adUseClient. I haven’t been able to avoid the error with any changes to the Source property, including selecting from a query or subquery instead of the table. Only removing the adUseClient CursorLocation property works.

Leave a Reply

Your email address will not be published. Required fields are marked *