G
Guest
I would like to know if a user responded to an action query warning message
with 'Yes' or 'No' to determine what to do next.
My delete query removes records from an unrelated table which matches an
'Item Code' on a subform when the user presses Ctrl-D. Then I would like to
delete the record on the subform also if the user OK'd the delete message.
Case vbKeyD
On Error Resume Next ' stop errors from Ctrl-D on blank line
KeyCode = 0 ' cancel keystroke
DoCmd.RunSQL "DELETE * " & _
"FROM [Table1] " & _
"WHERE [Table1].[Item Code]='" & [Item Code] & "'"
Dim rstMEform As dao.Recordset
Set rstMEform = Me.Recordset
rstMEform.Delete ' delete current record on subform
I thought about checking the table to see if there are any occurances of the
"Item Code" once the delete query had run, but this doesn't guarantee how the
user responded because there may not been any "Item Code" records in the
table to begin with.
Any thoughts?
Thanks
James
with 'Yes' or 'No' to determine what to do next.
My delete query removes records from an unrelated table which matches an
'Item Code' on a subform when the user presses Ctrl-D. Then I would like to
delete the record on the subform also if the user OK'd the delete message.
Case vbKeyD
On Error Resume Next ' stop errors from Ctrl-D on blank line
KeyCode = 0 ' cancel keystroke
DoCmd.RunSQL "DELETE * " & _
"FROM [Table1] " & _
"WHERE [Table1].[Item Code]='" & [Item Code] & "'"
Dim rstMEform As dao.Recordset
Set rstMEform = Me.Recordset
rstMEform.Delete ' delete current record on subform
I thought about checking the table to see if there are any occurances of the
"Item Code" once the delete query had run, but this doesn't guarantee how the
user responded because there may not been any "Item Code" records in the
table to begin with.
Any thoughts?
Thanks
James