I'm trying to delete a record and then move to the one before the deleted record. But I can't get it to work, and now I'm getting
run-time error 2046 The command or action 'DeleteReord' isn't available now.
What am I doing wrong here? How should I handle this?
Private Sub Command24_Click()
On Error GoTo Err_Command24_Click
If Me![dbo_HR_Trainings Subform].Form.Recordset.RecordCount > 0 Then
MsgBox "You cannot delete a category that has members.", vbOKOnly
GoTo Exit_Command24_Click
Else
Select Case MsgBox("Are you sure you want to delete this category?", vbYesNo, "Are you sure?")
Case vbYes
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.GoToRecord , , acPrevious
Case Else
End Select
End If
Exit_Command24_Click:
Exit Sub
Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click
End Sub