2

我在UPDATE tblTable SET DataSet=3事务中执行了一个简单的操作,但是在尝试运行它几秒钟后,我得到一个 3035 - 超出系统资源。大约有 30K 行。

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

请知道为什么会发生这种情况以及如何避免它。

4

1 回答 1

0

似乎您正在更新整个表格,即没有 where 条件,您确定要更新整个表格吗?如果您在循环中更新整个表格(我在您的代码中看不到循环,您仍然可能会调用它循环中的过程)系统很可能会出现此错误。

于 2012-09-03T09:34:29.730 回答