Hi everyone,

i have these code

If MsgBox("Do you want to delete these record", vbYesNo) = vbYes Then
Me.Dirty = False
DoCmd.OpenQuery "Q3"
DoCmd.SetWarnings False
Call DoCmd.RunCommand(Command:=acCmdDeleteRecord)
'DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Me.Refresh
MsgBox "Record is deleted successfully"
End If

the quary Q3 is update quary that update quntity to a item_table the is bounded to another tables, i am trying to return the quntity to the item_stock that is retrieval before i delete the bill, update and delete at the same time, i try to run each command Separatly and it's work perfectly but i want to do thses two command at the same time when the user click button.


i edit the code like these

If MsgBox("Do you want to delete these record", vbYesNo) = vbYes Then
Me.Dirty = False
DoCmd.OpenQuery "Q3"
CurrentDb.Execute "Q3", dbFailOnError
Me.Refresh
MsgBox "Record is deleted successfully"
End If

but another error is appear to me error 3061

is these any other ideas?!
when i run these code from click button event error 3197 appear to me, what is the wrong in my code.

Regards