我正在尝试删除一条记录,然后移至已删除记录之前的记录。但我无法让它工作,现在我得到了
运行时错误 2046 命令或操作“DeleteReord”现在不可用。
我在这里做错了什么?我该如何处理?
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