I need help on this. Mu idea is when the user clicks on the save button, it will transfer its current record to another table and delete it from the existing one.
The SQL insert command works well on its own, but when I added the SQL delete command below it, a syntax error occurs and it doesn't save the record to the other table. What's wrong with this code?
Private Sub command_save_Click()
On Error GoTo Err_command_save_Click
DoCmd.RunSQL "Insert Into [Evaluation_Archive] Select * from [Evaluation] where [Evaluation].[Registration_ID]= " & Me![Registration_ID] & ""
DoCmd.RunSQL "DELETE FROM [Evaluation] Select * from [Evaluation] where [Evaluation].[Registration_ID]= " & Me![Registration_ID] & ""
DoCmd.Close
Exit_command_save_Click:
Exit Sub
Err_command_save_Click:
MsgBox Err.Description
Resume Exit_command_save_Click
End Sub
The SQL insert command works well on its own, but when I added the SQL delete command below it, a syntax error occurs and it doesn't save the record to the other table. What's wrong with this code?
Private Sub command_save_Click()
On Error GoTo Err_command_save_Click
DoCmd.RunSQL "Insert Into [Evaluation_Archive] Select * from [Evaluation] where [Evaluation].[Registration_ID]= " & Me![Registration_ID] & ""
DoCmd.RunSQL "DELETE FROM [Evaluation] Select * from [Evaluation] where [Evaluation].[Registration_ID]= " & Me![Registration_ID] & ""
DoCmd.Close
Exit_command_save_Click:
Exit Sub
Err_command_save_Click:
MsgBox Err.Description
Resume Exit_command_save_Click
End Sub