删除记录,移动previous不工作 [英] delete record and move previous not working

查看:112
本文介绍了删除记录,移动previous不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除记录,然后移动到已删除的记录之前的数值。但我无法得到它的工作,现在我越来越

  

运行时错误2046的命令或操作'DeleteReord'现在不可用。

我在做什么错在这里?我应该如何处理呢?

 私人小组Command24_Click()
对错误转到Err_Command24_Click

!如果我[dbo_HR_Trainings子窗体] .Form.Recordset.RecordCount> 0然后
        MSGBOX你不能删除有成员类别。,vbOKOnly
        转到Exit_Command24_Click
其他

        选择案例MSGBOX(你确定要删除此类别?,vbYesNo,你确定吗?)
                案例vbYes
                        DoCmd.RunCommand acCmdSelectRecord
                        DoCmd.RunCommand acCmdDeleteRecord

                        DoCmd.GoToRecord,AC previous
                案例否则
        最终选择
结束如果

Exit_Command24_Click:
    退出小组

Err_Command24_Click:
    MSGBOX Err.Description它将
    简历Exit_Command24_Click

结束小组
 

解决方案

好像你在调试模式下的错误。不要设置的DoCmd命令的断点。这将总是失败。

如果不是这种情况,那么在这里你可以找到的实现要通过使用书签什么可能的方式之一: http://www.granite.ab.ca/access/positioning_on_a_continuous_form.htm

请注意的例子是连续的形式,但你可以得到的想法。

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

解决方案

Seems like you get the error in Debug mode. Do not set a breakpoint on DoCmd commands. This will always fail.

If this is not the case, then here you can find one of the possible ways to accomplish what you want by using Bookmark: http://www.granite.ab.ca/access/positioning_on_a_continuous_form.htm

Please note the example is for continuous forms but you can get the idea.

这篇关于删除记录,移动previous不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆