jpkeller55
Technical User
I have a button on a form that deletes records from a table and would like to have the deleted records copied to another table prior to deleting. I am using the following code to delete the record which works fine. Can anybody help me with code that I may add to this to perform the copy function?
Private Sub cmdDelete_Click()
'Deletes current record from ReferralDetail table
On Error GoTo Err_cmdDelete_Click
DoCmd.RunSQL "DELETE FROM [ReferralDetail] WHERE [ID] = FormID"
DoCmd.Requery
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
Thanks, Jim
Private Sub cmdDelete_Click()
'Deletes current record from ReferralDetail table
On Error GoTo Err_cmdDelete_Click
DoCmd.RunSQL "DELETE FROM [ReferralDetail] WHERE [ID] = FormID"
DoCmd.Requery
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
Thanks, Jim