更改删除键上的错误消息 [英] Changing the error message on delete key

查看:75
本文介绍了更改删除键上的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表单中,由于参照完整性,我无法删除某些记录。因此,当我按下具有子字段的那些记录上的删除键时,我得到ms访问错误(No3300)消息记录不能被删除或更改,因为...... 。有没有办法自定义这条消息?


非常感谢你的关注。

美好的一天。

Hi, in my form I can''t delete certain records because of referential integrity. Therefore, when I press the delete key on those records which have child fields I get an ms-access error (No3300) message "The records can''t be deleted or changed because..." . Is there any way to customize this message?

Thanks a lot for your attention.
Good day.

推荐答案

很难,因为它是一条喷射消息。

就个人而言,我试图通过阻止无法删除的记录来阻止这种情况。

当您签入(子)表格的OnCurrent事件或存在相关记录时,请禁用表单上的[Del]按钮,否则启用它。

那样的话用户有视觉反馈或删除是一个选项..

Nic; o)
Thta''s hard as it''s a jet-message.
Personally I try to prevent this by blocking the records that can''t be deleted.
When you check in the OnCurrent event of the (sub)form or a related record is present, then disable the [Del] button on your form, else enable it.
That way the user has visual feedback or deletion is an option..
Nic;o)


您没有确切地指定您的表单如何工作,但您应该能够在删除发生之前在表单中输入一些代码以测试相关记录并插入您自己的msgbox。这将在访问错误消息之前取消删除。


如果不是IsNull(DLookup(Qu Quoted by",[Quote Table],[] QU引用] =''"& Me.EmpCode&"''"))然后


MsgBox无法删除记录,因为存在关联记录。 ;

取消=真


结束如果


你可以添加额外的dlookup来测试其他表中的记录通过在一个if语句中使用AND或使用嵌套的ifs。
You didn''t exactly specify how your form works but you should be able to enter some code in the forms beforedeleteconfim event to test for related records before the delete occurs and insert your own msgbox. This will cancel the delete before accesses error message.

If Not IsNull(DLookup("[Qu Quoted by]", "[Quote Table]", "[QU Quoted by] = ''" & Me.EmpCode & "''")) Then

MsgBox "Can Not Delete Record Because Associated Records Exist."
Cancel = True

End If

you can add addition dlookups to test for records in other tables by use AND in the one if Statement or use nested ifs.


亲爱的Nico和Mseda。你的建议都很有帮助。我会选择Mseda的,因为用户很少需要删除记录,因此耗电量较少。
Dear Nico and Mseda. Both your advices are helpful. I''ll go for Mseda''s one as it takes less computer power as the user very seldom has to delete a record.


这篇关于更改删除键上的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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