change control source upon combo value

G

Guest

hi all,

is it possilbe to change the control source of the text box depending on the
value chosen from a combo-box?

I tryed to list the control source codes in the hidden column of my combo,
and then put the below coding on the combo's "on change event"
Me.Text1 = Forms.MAIN.Combo123.Column(2)

but it wouldn't work. It would give me just the values which i have in my
hidden column like "[Table1].[FieldA]". I guess that may be i used wrong
syntaxis?

what i want is the text box to display actual value of the FieldA from
Table1 if i choose the value "A" in the Combo. (combo is populated from
Table2)

How can i do that - can somebody help?

If i had just 3-4 values in my combo list - i guess i could have used some
"if - then" coding, but my list has some 40 values ... - is there any good
solution for this?

Thank you.
Lana
 
G

Graham Mandeno

Hi Lana

You are changing the Value of the textbox (which is the default property),
not the ControlSource. Try:

Me.Text1.ControlSource = Forms.MAIN.Combo123.Column(2)

BTW, assuming Text1 and Combo123 are both on the same form, you should use:

Me.Text1.ControlSource = Me.Combo123.Column(2)
 
G

Guest

I am not sure it will be necessary, but if you don't see the data change once
the command is issued, it may require a repaint to show the change in data.

Graham Mandeno said:
Hi Lana

You are changing the Value of the textbox (which is the default property),
not the ControlSource. Try:

Me.Text1.ControlSource = Forms.MAIN.Combo123.Column(2)

BTW, assuming Text1 and Combo123 are both on the same form, you should use:

Me.Text1.ControlSource = Me.Combo123.Column(2)

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Lana said:
hi all,

is it possilbe to change the control source of the text box depending on
the
value chosen from a combo-box?

I tryed to list the control source codes in the hidden column of my combo,
and then put the below coding on the combo's "on change event"
Me.Text1 = Forms.MAIN.Combo123.Column(2)

but it wouldn't work. It would give me just the values which i have in my
hidden column like "[Table1].[FieldA]". I guess that may be i used wrong
syntaxis?

what i want is the text box to display actual value of the FieldA from
Table1 if i choose the value "A" in the Combo. (combo is populated from
Table2)

How can i do that - can somebody help?

If i had just 3-4 values in my combo list - i guess i could have used some
"if - then" coding, but my list has some 40 values ... - is there any good
solution for this?

Thank you.
Lana
 
G

Guest

Thank you Graham. If worked fine!
Lana


Graham Mandeno said:
Hi Lana

You are changing the Value of the textbox (which is the default property),
not the ControlSource. Try:

Me.Text1.ControlSource = Forms.MAIN.Combo123.Column(2)

BTW, assuming Text1 and Combo123 are both on the same form, you should use:

Me.Text1.ControlSource = Me.Combo123.Column(2)

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Lana said:
hi all,

is it possilbe to change the control source of the text box depending on
the
value chosen from a combo-box?

I tryed to list the control source codes in the hidden column of my combo,
and then put the below coding on the combo's "on change event"
Me.Text1 = Forms.MAIN.Combo123.Column(2)

but it wouldn't work. It would give me just the values which i have in my
hidden column like "[Table1].[FieldA]". I guess that may be i used wrong
syntaxis?

what i want is the text box to display actual value of the FieldA from
Table1 if i choose the value "A" in the Combo. (combo is populated from
Table2)

How can i do that - can somebody help?

If i had just 3-4 values in my combo list - i guess i could have used some
"if - then" coding, but my list has some 40 values ... - is there any good
solution for this?

Thank you.
Lana
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top