如何更新与 Environ 用户名匹配的多条记录? Microsoft Access 数据库引擎找不到输入 table

How can I update multiple records which match with the Environ Username? Microsoft Access database engine cannot find the input table

我想将状态字段更改为“已完成”,其中 environ 用户名在整个 table 中匹配并且 table 包含超过 400 条记录,其中大约 150 条记录与 environ 用户名匹配.

Private Sub Command1_Click()

Dim db as DAO.Database
Dim rs as DAO.Recordset

set db = currentdb
set rs = db.OpenRecordset("UPDATE * from Upload_Report set status = '" & Completed & "' Where Analyst = '" & Environ("Username") & "'")

If Not rs.EOF then
    MsgBox "Records were updated!", VBInformation
Else
    MsgBox "Match not found", VBExclamation
End if

End sub

代码抛出

"Run-time error '3078':
The Microsoft Access database engine cannot find the input table or query 'UPDATE * from Upload_Report set status = 'completed' where Analyst = '*****'". Make sure it exists and that its name is spelled correctly."

我用 table (Upload_Report) 进行了交叉验证,没有发现拼写错误。

如何更新与 Environ 用户名匹配的多条记录?

OpenRecordset 用于读取。

你想要的是 db.Execute "UPDATE ..."