System Resources Exceeded whilst performing UPDATE

2019-07-21 00:19发布

问题:

I'm performing a simple UPDATE tblTable SET DataSet=3 inside a transaction, but a few seconds after trying to run it, I get a 3035 - System Resources exceeded. There are ~30K rows.

Dim db As DAO.Database, wrk As DAO.Workspace, errCount As Long, stSQL As String

Set db = CurrentDb
Set wrk = DBEngine.Workspaces(0)
errCount = 0
wrk.BeginTrans
    Debug.Print "There are no existing entries in the selected DataSet, preparing to proceed..."
    ' - -- ---
    stSQL = "UPDATE tblImportCleaned SET DataSetID=" & Me.lstDataSets
    db.Execute stSQL, dbSeeChanges
    If db.RecordsAffected < 1 Then errCount = errCount + 1
    Me.frmImport_CleanedSubform.Requery
    ' - -- ---

If errCount = 0 Then
    If MsgBox("There were no errors, would you like to COMMIT the changes?", vbYesNo) = vbYes Then
        wrk.CommitTrans
    Else
        wrk.Rollback
    End If
Else
    wrk.Rollback
End If
wrk.Close

Any idea why this is happening and how I can avoid it please.

回答1:

It seems to be you are updating entire table i.e without where condition, are you sure you want to update entire table and if you are updating entire table in a loop (i don't see loop in you code, still you may be calling this procedure in a loop) system has high possibility of getting this error.