在另一个组合框中选择值后自动填充字段 [英] Autofilled field after chose value in another combobox

查看:77
本文介绍了在另一个组合框中选择值后自动填充字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两张桌子,一张包括公司信息,如姓名和电话

号码。

另一张桌子,我必须填写联系人。

表格的一部分是选择他所工作的公司(从列表框中)。然后,

我选择了公司后,我想在第一张桌子上自动填写

电话号码。但是,这就是为什么我想拥有它

在表中得到了(所以没有冗余):我希望这个领域

phonenumber可以编辑为公司电话号码并不总是

来自联系人的直接电话号码。


方法应如下:

使用ComboBox用于进入公司并包含隐藏栏

,其中包含

电话号码。在ComboBox的AfterUpdate事件中有代码......

Me.ContactPhone = Me.Company.Column(n)

....其中''n''是隐藏电话号码的零位置

ComboBox中的
列。


现在,我已经中途了程序。


我的问题:

ContactPhone字段中的设置怎么样。

必须像

Me.ContactPhone = Len(me!ContactPhone)
GotFocus或BeforeUpdate中的


Bart

解决方案

" AA Arens" < BA *********** @ gmail.com>写在

新闻:11 ********************** @ i40g2000cwc.googlegr psps.com:

我有两张桌子,一张包括公司信息,如姓名和
电话号码。
另一张桌子,我必须填写联系人。
部分表格是选择他工作的公司(来自
列表框)。然后,在我选择了公司后,我希望自动填写第一张表中的现场电话号码。但是,
这就是为什么我想让它在表中得到满足(所以没有冗余):我希望可以编辑现场电话号码
因为公司电话号码是并不总是来自联系人的直接号码。

该方法应该是:
使用ComboBox进入公司并包含一个隐藏的

电话号码。在ComboBox的AfterUpdate事件中有代码...... Me.ContactPhone = Me.Company.Column(n)
...其中''n''是隐藏手机的零位置
组合框中的数字栏。

现在,我正处于该程序的中途。

我的问题:
如何设置在ContactPhone字段中。
在GotFocus或BeforeUpdate中,是否必须像
Me.ContactPhone = Len(我!ContactPhone)



你不要如果你想允许

更改它,那么在ContactPhone中什么都不需要。


如果你想在公司改变时防止改变它,并且

我不明白为什么你需要这样做,只需在更新后的组合框更新事件中添加条件




Company_AfterUpdate

IF len(me.Contactphone)& "" = 0然后

Me.ContactPhone = Me.Company.Column(n)

ENDIF


-

Bob Quintal


PA是我改变了我的电子邮件地址。


Bob Quintal写道:< blockquote class =post_quotes>

如果你想改变它,你在ContactPhone中不需要任何东西。

如果你愿意的话为了防止在公司发生变化时更改它,并且
我看不出你为什么需要这样做,只需在更新后的组合框中为你的更新添加一个条件。
Company_AfterUpdate
IF len(me.Contactphone)& "" = 0然后
Me.ContactPhone = Me.Company.Column(n)
ENDIF




一个小小的狡辩,鲍勃。

IF len(me.Contactphone)& "" = 0然后




我认为连接应该在括号内。


IF len(me.Contactphone& "")= 0然后


-

Randy Harris

tech at promail dot com

我很确定我知道我能记住的一切。


Randy Harris< pl **** @ send.no.spam>写在

新闻:Iz ****************** @ newssvr25.news.prodigy.n et:

Bob Quintal写道:


如果您希望
允许,您在ContactPhone中不需要任何内容要改变它。

如果你希望在公司改变时防止改变它,
我无法理解为什么你需要这样做,只需加上
条件你在组合框更新后的更新。

Company_AfterUpdate
IF len(me.Contactphone)& "" = 0然后
Me.ContactPhone = Me.Company.Column(n)
ENDIF



一个小狡辩,鲍勃。

IF len(me.Contactphone)& "" = 0然后



我认为串联应该在
括号内。

IF len(me.Contactphone&"" )= 0然后




我知道连接应该在括号内,

来自调试我一直在做的类似错误。


-

Bob Quintal


PA是我改变了我的电子邮件地址。


I have two tables, one consists of company info like name and phone
number.
Another table where I have to fill in the contact persons. Part of the
form is to choose the company he works for (From a list box). Then,
after I choosed the conpany, I want to have auto filled in the field
phone number from the 1st table. But, and that''s why i want to have it
archieved in the table (so no redundancy): I want that the field
phonenumber can be editted as the company phone number is not always
the direct number from the contact person.

The method should be like:
Use a ComboBox for entering the Company and include a hidden column
that has the
phone number. In the AfterUpdate event of the ComboBox have code...
Me.ContactPhone = Me.Company.Column(n)
....where ''n'' is the zero based position of the hidden phone number
column in the
ComboBox.

Now, I am halfway in that procedure.

My question:
How about the setting in the ContactPhone field.
Must it be like
Me.ContactPhone = Len(me!ContactPhone)
in GotFocus or BeforeUpdate?
Bart

解决方案

"AA Arens" <ba***********@gmail.com> wrote in
news:11**********************@i40g2000cwc.googlegr oups.com:

I have two tables, one consists of company info like name and
phone number.
Another table where I have to fill in the contact persons.
Part of the form is to choose the company he works for (From a
list box). Then, after I choosed the conpany, I want to have
auto filled in the field phone number from the 1st table. But,
and that''s why i want to have it archieved in the table (so no
redundancy): I want that the field phonenumber can be editted
as the company phone number is not always the direct number
from the contact person.

The method should be like:
Use a ComboBox for entering the Company and include a hidden
column that has the
phone number. In the AfterUpdate event of the ComboBox have
code... Me.ContactPhone = Me.Company.Column(n)
...where ''n'' is the zero based position of the hidden phone
number column in the
ComboBox.

Now, I am halfway in that procedure.

My question:
How about the setting in the ContactPhone field.
Must it be like
Me.ContactPhone = Len(me!ContactPhone)
in GotFocus or BeforeUpdate?


You don''t need anything in the ContactPhone if you wish to allow
it to be changed.

If you wish to prevent changing it when the company changes, and
I cannot see why you would need to do that, just put a condition
on your update in the combobox After Update event.

Company_AfterUpdate
IF len(me.Contactphone) & "" = 0 Then
Me.ContactPhone = Me.Company.Column(n)
ENDIF

--
Bob Quintal

PA is y I''ve altered my email address.


Bob Quintal wrote:

You don''t need anything in the ContactPhone if you wish to allow
it to be changed.

If you wish to prevent changing it when the company changes, and
I cannot see why you would need to do that, just put a condition
on your update in the combobox After Update event.

Company_AfterUpdate
IF len(me.Contactphone) & "" = 0 Then
Me.ContactPhone = Me.Company.Column(n)
ENDIF



A minor quibble, Bob.
IF len(me.Contactphone) & "" = 0 Then



I think that the concatenation should be inside the parentheses.

IF len(me.Contactphone & "") = 0 Then

--
Randy Harris
tech at promail dot com
I''m pretty sure I know everything that I can remember.


Randy Harris <pl****@send.no.spam> wrote in
news:Iz******************@newssvr25.news.prodigy.n et:

Bob Quintal wrote:


You don''t need anything in the ContactPhone if you wish to
allow it to be changed.

If you wish to prevent changing it when the company changes,
and I cannot see why you would need to do that, just put a
condition on your update in the combobox After Update event.

Company_AfterUpdate
IF len(me.Contactphone) & "" = 0 Then
Me.ContactPhone = Me.Company.Column(n)
ENDIF



A minor quibble, Bob.

IF len(me.Contactphone) & "" = 0 Then



I think that the concatenation should be inside the
parentheses.

IF len(me.Contactphone & "") = 0 Then



I know that the concatenation should be inside the parentheses,
from debugging similar errors I keep making.

--
Bob Quintal

PA is y I''ve altered my email address.


这篇关于在另一个组合框中选择值后自动填充字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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