尝试取消表单的BeforeUpdate事件时,为什么会出现错误? [英] Why am I getting an error when trying to cancel my form's BeforeUpdate event?

查看:157
本文介绍了尝试取消表单的BeforeUpdate事件时,为什么会出现错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试取消表单'的BeforeUpdate事件时出错。它说:
此时您无法保存此记录。

ACH Manager在尝试保存记录时可能遇到错误。

如果您现在关闭此对象,您所做的数据更改将会丢失。

您是否要关闭数据库对象?

这是我的代码:

I am getting an error when trying to cancel my form''s BeforeUpdate event. It says:
You can''t save this record at this time.
ACH Manager may have encountered an error while trying to save a record.
If you close this object now, the data changes you made will be lost.
Do you want to close the database object anyway?
Here is my code:

展开 | 选择 | Wrap | 行号

推荐答案

听起来表格正在关闭而不是记录只是保存赛斯。当您设置取消=真时,确保为保存调用的任何代码都将返回失败。它与报告的NoData事件非常相似。在事件处理程序中设置取消=真是标准做法,但是当完成此操作时,会告知调用代码发生了错误。在您理解并做好准备之前会感到困惑。
It sounds like the form is being closed rather than the record simply being saved Seth. When you set Cancel = True that ensures that whatever code called for the save will get a failure return. It''s very similar to the NoData event of a report. It''s standard practice to set Cancel = True in the event handler, yet when this is done the calling code is told that an error occurred. Confusing until you understand and prepare for it.


我想我确实错过了触发事件的重要细节:点击关闭按钮(默认按钮,不是自定义按钮) 。如果它有帮助,这与我之前的问题有关如何阻止表单从BeforeUpdate事件中关闭。我打算在这个帖子中发布这个帖子,但我决定自己会更好。


我做了网络搜索,以确保我做得对,发现它完成了如您在事件处理程序中描述的那样。那么我需要做些什么来做好准备呢? DoCmd.RunCommand acCmdUndo 会更好吗?
I guess I did miss giving the important detail of what triggered the event: clicking on the close button (the default one, not a custom one). If it helps, this is related to my previous question How do I stop a form from closing from the BeforeUpdate event. I was going to post this in that thread, but decided that it would be better on its own.

I did a web search to make sure I was doing it right and found it done as you describe in the event handler. So what do I need to do to prepare for it? Would DoCmd.RunCommand acCmdUndo work better?


这取决于您实际想要发生的事情 - 在所有可能的情况下。一种可能性是撤消任何更改,但这不是唯一可行的选择。我们需要更好地了解您的要求,以指导您到达目的地。
That depends on what you actually want to happen - in all possible circumstances. One possibility is to undo any changes, but that isn''t the only possible option. We need a better understanding of your requirements to guide you where you need to go.


这篇关于尝试取消表单的BeforeUpdate事件时,为什么会出现错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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