I have a cmd button on a form to delete the record:
Private Sub Command121_Click()
On Error GoTo Err_Command121_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Command121_Click:
Exit Sub
Err_Command121_Click:
MsgBox Err.Description
Resume Exit_Command121_Click
End Sub
This works fine if I just open the form with all records. When I use a filter to open just one record, and then use the button to delete it, I get an error message. clicking on the red X in the toolbar works.
How can I change this code to delete the filtered record without an error?
Private Sub Command121_Click()
On Error GoTo Err_Command121_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Command121_Click:
Exit Sub
Err_Command121_Click:
MsgBox Err.Description
Resume Exit_Command121_Click
End Sub
This works fine if I just open the form with all records. When I use a filter to open just one record, and then use the button to delete it, I get an error message. clicking on the red X in the toolbar works.
How can I change this code to delete the filtered record without an error?