1

我有一个用于过滤列表框的文本框。文本框旁边有一个命令按钮。我在文本框中输入了一些过滤数据,然后将鼠标移动到命令按钮并单击。文本框中的所有相应事件都会触发,但命令按钮的单击事件不会触发。

我在 Windows 8 虚拟机(Mac 上的 Parallels)上运行 Access 2013。

这是正常活动吗?

下面是来自以下活动的事件跟踪:在文本框中输入字符“农场”,然后单击搜索命令按钮。注意 - 命令按钮不会触发任何事件。

mIndustryFind==> tbxSearchText_Enter
mIndustryFind==> tbxSearchText_GotFocus
mIndustryFind==> tbxSearchText_KeyDown
mIndustryFind==> tbxSearchText_KeyPress
mIndustryFind==> tbxSearchText_Change
mIndustryFind==> tbxSearchText_KeyUp
mIndustryFind==> tbxSearchText_KeyDown
mIndustryFind==> tbxSearchText_KeyPress
mIndustryFind==> tbxSearchText_Change
mIndustryFind==> tbxSearchText_KeyUp
mIndustryFind==> tbxSearchText_KeyDown
mIndustryFind==> tbxSearchText_KeyPress
mIndustryFind==> tbxSearchText_Change
mIndustryFind==> tbxSearchText_KeyUp
mIndustryFind==> tbxSearchText_KeyDown
mIndustryFind==> tbxSearchText_KeyPress
mIndustryFind==> tbxSearchText_Change
mIndustryFind==> tbxSearchText_KeyUp
mIndustryFind==> tbxSearchText_BeforeUpdate
mIndustryFind==> tbxSearchText_AfterUpdate
mIndustryFind==> tbxSearchText_Exit
mIndustryFind==> tbxSearchText_LostFocus
mIndustryFind==> tbxSearchText_MouseMove
4

1 回答 1

1

注释掉表单代码模块中现有的单击事件过程。然后在设计视图中使用窗体,打开命令按钮的属性表并单击 On Click 事件的省略号以在窗体模块中创建一个新的过程存根。向该存根添加一个简单的语句。

MsgBox "button clicked"

如果该新过程有效,请将其主体替换为您的原始代码。

这个建议的原因是我发现 Access 偶尔会“丢失跟踪”事件过程 --- 尽管它们存在于模块中,但它们在运行时无法识别。我描述的步骤一直可以解决这些问题。

但是,尽管您的情况听起来有些相似,但我根本不相信这是解释。这可能是一个长镜头,但排除它不应该花费你太多。

于 2013-07-25T16:44:48.267 回答