Forum Discussion
Run-time Error '3340'
JonathynYes, this the erroneous Query is Corrupt message caused by the Security Update Microsoft released last week. My team wrote a paper that describes the problem in more detail, the causes, Microsoft responses and workarounds you can make now:
http://fmsinc.com/MicrosoftAccess/Errors/query_is_corrupt/
Hope this helps.
- CaptainTall45Nov 25, 2019Copper Contributor
I have this Access error. I have Office 365 and I have followed the suggestion to update my Office version within Access. I have done this and now have version 1910 Build 12130.20410 Click-to-Run. This is the latest update. The error still persists. Please help !!!
- Terry_WagnerDec 03, 2019Copper Contributor
CaptainTall45 I had the same issue crop up
The problem code was a docmd.runsql "Update Table Set field1 = #" & now() & "# Where ID = " & str(intID)
I changed it to
dim wrst as recordset
set wrst = currentdb.openrecordset("SELECT * FROM Table WHERE ID = " & str(intID))
if not wrst.eof then
wrst.edit
wrst("field1") = now()
wrst.update
end if
wrst.close
- Alexandre _ NevesNov 29, 2019Copper Contributor
Não altere 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