BeforeUpdate vbYesNoCancel [英] BeforeUpdate vbYesNoCancel

查看:54
本文介绍了BeforeUpdate vbYesNoCancel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户单击表单退出按钮或表单窗口X按钮并且表单脏了,则从子Form_BeforeUpdate调用vbYesNoCancel msgbox函数。


如果用户点击canel,如何停止退出子(即表单关闭)?


谢谢。

vbYesNoCancel msgbox function gets called from sub Form_BeforeUpdate if user clicks form exit button or the form window X button and the form is dirty.

Howto halt the exit sub (ie. form close) if the user clicks canel?

thanks.

推荐答案


vbYesNoCancel msgbox函数从sub调用Form_BeforeUpdate如果用户单击表单退出按钮或表单窗口X按钮并且表单是脏的。


如果用户点击canel,如何停止退出子(即表单关闭)?


谢谢。
vbYesNoCancel msgbox function gets called from sub Form_BeforeUpdate if user clicks form exit button or the form window X button and the form is dirty.

Howto halt the exit sub (ie. form close) if the user clicks canel?

thanks.



嗨。在BeforeUpdate事件代码中将Cancel参数设置为True:

Hi. Set the Cancel parameter to True within your BeforeUpdate event code:

展开 | 选择 | Wrap | 行号


嗨斯图尔特,谢谢你的帮助,你有帮助我比你知道更多:)。


如果me.dirty那么......

我在beforeUpdate子句中插入Cancel = True它不起作用

结果是


1.通过表格退出按钮关闭子

取消仍然关闭表格,

如果我尝试将Cancel = True放入退出按钮sub我得到一个未定义的变量错误


2.关闭窗口x表单按钮

提示msgbox你这次不能保存记录...关闭表单是/否(关闭:))


谢谢你的帮助
Hi Stewart, thank you for your help, you have helped me more than you know :).

If me.dirty then...

I insert Cancel = True into the beforeUpdate sub it doesn''t work
the results are

1. close through form exit button sub
cancel still closes form,
if I try to put Cancel = True into the exit button sub I get a variable not defined error

2. close through window x form button
prompts msgbox You can''t save the record @ this time... close form yes/no (close :))

thank you for your help



嗨斯图尔特,谢谢你的帮助,你帮助了我的比你知道的更多:)。


如果我在beforeUpdate sub中插入Cancel = True它不起作用

结果是


1.关闭表单退出按钮子

取消仍然关闭表单,

如果我尝试将Cancel = True放入退出按钮sub我得到一个未定义的变量错误


2.通过窗口关闭x表格按钮

提示msgbox你这次不能保存记录...关闭表单是/否(关闭:))


感谢您的帮助
Hi Stewart, thank you for your help, you have helped me more than you know :).

If I insert Cancel = True into the beforeUpdate sub it doesn''t work
the results are

1. close through form exit button sub
cancel still closes form,
if I try to put Cancel = True into the exit button sub I get a variable not defined error

2. close through window x form button
prompts msgbox You can''t save the record @ this time... close form yes/no (close :))

thank you for your help



为了防止表单关闭,您必须使用Form_Unload事件(它有取消参数)。例如:

In order to prevent form closing you have to use Form_Unload event (it has Cancel argument). For instance:

展开 | 选择 | Wrap | 行号


这篇关于BeforeUpdate vbYesNoCancel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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