Combobox AfterUpdate Bizarre [英] Combobox AfterUpdate Bizarre

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

问题描述

这很奇怪......我遇到组合框AfterUpdate事件的问题:


我正在运行Access 2003.


我创建了一个表单上有3列的未绑定组合框。

行源来自表格。

绑定列= 1和LimitToList =否,,因此用户可以编辑第一列中的数据在选择了组合框中的一行后。


但是,我想保存第二列和第三列的数据,因为如果用户编辑第一列,结果文本可能不在行源中,这将导致第二列和第三列变为空白。


因此我创建了两个文本框(TextA和TextB)每次用户从组合框中选择一行时都存储第二列和第三列的值。


我为Combobox输入了以下代码'' ■AfterUpdate事件:

This is bizarre... Im having problems with the combobox AfterUpdate event:

Im running Access 2003.

I created an unbound combobox with 3 columns on a form.
The Row Source is from a table.
Bound Column = 1 and LimitToList = No,,, thus the user can edit the data in the 1st-Column after they selected one of the rows in the combobox.

However, I want to save the data of 2nd-Column and 3rd-Column, because if the user edits the 1st-column, the resulting text might not be in the Row Source, which will result in 2nd-Column and 3rd-Column to go blank.

I thus created two text boxes (TextA and TextB) to store the values of 2nd-Column and 3rd-Column each time the user selects a row from the combobox.

I entered the following code for the Combobox''s AfterUpdate event:

展开 | 选择 | Wrap | 行号

推荐答案

你有任何代码吗?包含控件的表单的OnCurrent事件?

此代码可能是您的问题....
Do you have any code in OnCurrent event of the form that holds the controls?
This code might be your problem....


Hallo


是的,我在主要形式的'On Current事件中有相当长的代码安静,但这不是问题,因为我将组合框和两个文本框复制到一个新的空白表单上,其他内容没有其他内容。但是这个问题一直在重演。


我必须给你发送mdb的副本,删除所有内容除了这个小形式和组合框的行表的小表?


我在论坛的某个地方得到了一个提示,将我的所有组合框的代码从After Update事件移动到On Lost Focus事件。这似乎已经成功了。尽管如此,也许很多人都不知道他们的组合框''AfterUpdate活动有时也有效。


Gerhard
Hallo

Yes, I have quite a lengthy peace of code in the main form''s On Current event, but that is not the problem, because I copied the combobox and the two text boxes to a new blank form with nothing else on it. But the problem keeps on repeating itself.

Must I email you a copy of the mdb with everything removed except for this one little form and the small table for the combobox''s Row Source?

I got a tip somewhere in a forum to move all my combobox''s code from the After Update event to the On Lost Focus event. This seems to have done the trick. Still, maybe lots of people don''t know that their comboboxes'' AfterUpdate events work sometimes and sometimes not.

Gerhard


诀窍是在成功更新后将要运行的代码放入AfterUpdate事件过程,以及在LostFocus事件过程中控件失去焦点时要运行的代码。
The trick is to put the code you want to run after a successful update into the AfterUpdate event procedure, and the code you want to run whenever the control loses focus, in the LostFocus event procedure.


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

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