退出时可以阻止表单更新数据库吗? [英] Can you stop a form from updating the database when exiting?

查看:68
本文介绍了退出时可以阻止表单更新数据库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户关闭表单时,如何停止表单更新数据库?我有一个用于引用,添加和修改的表单,但每次关闭表单而不进行任何修改时,正在显示的条目随后会存储在数据库中,从而导致重复。我希望只有在选择正确的命令按钮时才允许添加和/或修改。如果他们只是关闭表单我不想存储到数据库。因为表单用于参考我将数据条目设置为NO。是否有捷径可寻?


请帮忙?

Birky

How can I stop a form from updating the database when a user closes the form? I have a form which is used for referencing, additions, and modifications but every time the form is closed with no modifications the entry which is being displayed is then stored in the database causing duplicates. My hope is to only allow additions and or modifications if they select the proper command button. If they just close the form I would like nothing stored to the database. Because the form is used for reference I have the Data Entry set to NO. Is there an easy way to do this?

Please help?
Birky

推荐答案

在表单的OnClose事件过程中,包括如下内容:
In the OnClose event procedure for your form, include something like :
展开 < span class =codeDivider> | 选择 | Wrap | Line数字


如果代码位于调用DoCmd.Close函数的控件对象后面,但是如果使用Forms CloseBox(表单边框上的上部X),则此方法有效在表单关闭之前保存记录。知道如何让我停止更新并立即关闭表格吗?注意我已经在表单OnClose事件中尝试了Undo和Dirty选项,如果选择了这个X,它们似乎都没有停止保存。

This works if the code is behind a control object which is calling the DoCmd.Close function but if the Forms CloseBox (upper X on the forms border) is used the record is saved before the form is closed. Any idea how I can get this to stop updating and just close the form straight away? Note I have tried the both the Undo and Dirty options within the forms OnClose event and neither seem to stop the saving if this X is selected.

展开 | 选择 < span class =codeDivider> | Wrap | 行号


尝试将此项置于On Close事件中。
Try putting this in the On Close event.
展开 | 选择 | Wrap | 行号


这篇关于退出时可以阻止表单更新数据库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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