Home > Software engineering >  Microsoft acces database engine cannot find the input table
Microsoft acces database engine cannot find the input table

Time:11-12

I want to change the Status field to "Completed" where the environ username matches in the whole table and the table contains more than 400 records which matches approx 150 records with environ user name.

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

It won't execute, the code throwing

"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."

I've cross verified with my table(Upload_Report) and there is no spelling errors are identified. Can someone help me with this or any other easier way to update the multiple records which matches with the Environ Username.

CodePudding user response:

OpenRecordset is used for reading.

What you want is db.Execute "UPDATE ..."

  • Related