简体   繁体   中英

Deleting a record from table in MS ACCESS 2010

I am trying to delete records from the subreport that created with multiple tables data. Below is the code I write for this

CurrentDb.Execute "DELETE FROM StateBudget " & " WHERE S_ID=" & ("SLELECT ID FROM States " & " WHERE State=" & Me.subformStateBudget.Form.Recordset.Fields("State"))

And error appear like this

syntax error (missing operator) in query expression 'S_ID=SELECT ID FROM States WHERE State=????'.

Check this out

  CurrentDb.Execute "DELETE FROM StateBudget WHERE S_ID IN (SELECT ID FROM States WHERE State=" & Me.subformStateBudget.Form.Recordset.Fields("State") & ")"

And by the way You have got misspelling in select, You add that string wrongly. That Bracket before Select should be inside the string and many more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM