允许用户关闭表单而不保存 [英] Allow user to close a form without saving

查看:114
本文介绍了允许用户关闭表单而不保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在使用Access 2003,我有一个带有自定义cmdClose按钮的表单。按下时,会出现一个消息框,询问用户是否要返回上一个表单。


问题是如果用户输入了任何内容,则记录将被保存并且我试图避免这种情况,如果可能的话。


这是我的代码:

Hi everybody,

I''m using Access 2003 and I have a form that has a custom cmdClose button. When pressed, a message box appears asking if the user wants to go back to a previous form.

The problem is that if the user has typed in anything, the record is getting saved and I''m trying to avoid that, if possible.

Here''s my code:

展开 | 选择 | Wrap | 行号

推荐答案

您可以尝试在第7行和第7行之间添加此内容。 8

DoCmd.DoMenuItem acFormBar,acEditMenu,acUndo ,, acMenuVer70
You could try addig this between lines 7 & 8

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70



你可以试试在第7行和第7行之间加上这个8

DoCmd.DoMenuItem acFormBar,acEditMenu,acUndo,acMenuVer70
You could try addig this between lines 7 & 8

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70



这样做有什么作用?它是否会阻止记录被保存?我不熟悉DoMenuItem命令。

What does that do? Does it prevent the record from getting saved? I''m not familiar with the DoMenuItem command.


这些天真的应该避免使用DoMenuItems。它们是为了向后兼容而保留的。这个特别的一个是相同的

Me.Undo


这样可以让你有更多的机会进入。


Linq ; 0)>
The DoMenuItems really should be avoided these days. They''re kept for backwards compatibility. This particular one is the same as

Me.Undo

which has the added benefit of being much shoter to enter.

Linq ;0)>


这篇关于允许用户关闭表单而不保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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