如果按下取消命令,如何防止运行OnExit程序? [英] how to prevent running OnExit procedure, if pressing Cancel Command?

查看:50
本文介绍了如果按下取消命令,如何防止运行OnExit程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我按下取消命令,则文本框具有我不想运行的OnExit过程。按钮(我想要专门用于此角色的命令按钮)。


在取消命令按钮获取焦点之前,无论如何,链接到文本框RUNS的OnExit事件的过程!


在OnExit运行之前有没有办法拦截按下的命令按钮?

KeyDown只捕获按键,而不是命令按钮。我错了吗?虽然应该是类似的...

MouseDown只在文本框的退出proc后运行

需要帮助

a textbox has an OnExit procedure that I don''t want to run, if I pressed "Cancel command" button (a command button that I want to dedicate to this role).

before Cancel command button takes the focus, anyway the procedure linked to the OnExit event of the text box RUNS!

Is there a way to intercept the command button pressed, before OnExit runs?
KeyDown traps only the keys, not the command buttons. Am I wrong? Though should be something similar...
MouseDown runs only after the textbox''s Exit proc
help needed

推荐答案

你失去了我。您在同一个句子中以多种不同的方式使用单词取消来表示不同的内容。因为你永远不清楚每个人应该意味着什么,所以很难理解你在问什么。从你的名字来看,我猜英语不是你的第一语言,但如果你能再次提出这个问题,并且更清楚你所指的是什么,我希望我们可以提供帮助。

大多数事件程序(你在任何地方都没有提到它们,但我怀疑你在所有这些地方都在处理它们)有一个名为取消的参数如果它们可以打断。如果一个不存在,则不能跳过事件本身。这并不一定意味着你不能拥有你想要的东西,但是如果我们要帮助的话,我们需要了解它是什么。
You''ve lost me. You use the word Cancel in so many different ways in the same sentence, to mean different things. As you never make it clear what each is supposed to mean it''s very hard to understand what you''re asking. From your name I guess English isn''t your first language, but if you could try to ask the question again, and make it clearer what you''re referring to, I expect we could help.

Most event procedures (you don''t mention them by name anywhere, but I suspect you''re dealing with one anyway somewhere in all this) have a parameter called Cancel if they can be interrupted. If one doesn''t exist then the event itself cannot be skipped. That doesn''t necessarily mean you can''t have what you want, but we would need to understand what that is if we''re to help.


什么阻止你拦截OnExit并检查事件?
What is stopping you from intercepting the OnExit and examining the event?


首先,感谢您的回复,抱歉不够清楚。


让'这是这样说的:

Access 2003,VBA

表格:无界

tb_One:文字框一

有一个链接到OnExit事件的程序,它对tb_One上输入的值进行一些控制


tb_Two:表格上的下一个文本框


cb_Cmd_button:一个命令按钮

如果按下,我想取消tb_One'的编辑,不想验证它的内容


让我们假设我正在编辑tb_One,我想退出编辑它。我不在乎已经输入的价值,所以我不想要任何验证。

我该怎么办?


如果我在tb_One上按下了按键(在tb_One的KeyDown事件上链接的程序),它可以工作(见下文)

First of all, thank you for the reply an sorry for not being clear enough.

Let''s put it this way:
Access 2003, VBA
Form: unbounded
tb_One: text box one
has a procedure linked to the OnExit event that makes some control on the value entered on tb_One

tb_Two: the next text box on the form

cb_Cmd_button: a command button
if pressed, I want to cancel tb_One''s edit and don''t want to validate it''s content

Let''s suppose I''m editing tb_One and I want to get out from editing it. I don''t care about the value already entered, so I don''t want any validation for it.
How can I do it?

If I trap the key pressed while on tb_One (procedure linked on KeyDown event of tb_One), it works (see below)

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


这篇关于如果按下取消命令,如何防止运行OnExit程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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