Display combo box value in a text box (1 Viewer)

stimpy

New member
Local time
Today, 21:01
Joined
Aug 2, 2000
Messages
8
My form contains a text box and a combo box.
When a value is selected from the combo box I want it to be displayed in the text box.
The combo box contains a list of 4 digit postcodes(zipcodes. I have linked my text box to this combo box using the source property of the text box, but when I try it out I dont get the 4 digit value in the text box. Instead I get a 1 digit number that corresponds to the number in the list (eg if I choose the first postcode in the combobox then a 1 appears in the text box) I would greatly appreciate help on this as it is quite urgent
Thanks in advance
 

R. Hicks

AWF VIP
Local time
Today, 15:01
Joined
Dec 23, 1999
Messages
619
If your combobox's Row Source is linkined to multiple columns and the column you wish to use is not the bound column then you need to specify the column number in the control source in the txtbox. Remember that the column numbering is zero based, meaning that the first column is column(0). Here is an example that would work in the control source of a txtbox:

=[YourCombo].[Column](1)

"YourCombo" needs to be the actual name of your combobox. The would reflect the you want the second column of the Row Source to be linked to the txtbox.

HTH
RDH
 

Krij

Registered User.
Local time
Today, 22:01
Joined
Jun 29, 2006
Messages
29
Hi!

Private Sub cboSomething_AfterUpdate()
Me!txtSomething.Text = Me!cboSomething.Column(1)
End Sub


stimpy said:
My form contains a text box and a combo box.
When a value is selected from the combo box I want it to be displayed in the text box.
The combo box contains a list of 4 digit postcodes(zipcodes. I have linked my text box to this combo box using the source property of the text box, but when I try it out I dont get the 4 digit value in the text box. Instead I get a 1 digit number that corresponds to the number in the list (eg if I choose the first postcode in the combobox then a 1 appears in the text box) I would greatly appreciate help on this as it is quite urgent
Thanks in advance
 

accessuser67

Registered User.
Local time
Today, 16:01
Joined
Dec 28, 2012
Messages
15
If your combobox's Row Source is linkined to multiple columns and the column you wish to use is not the bound column then you need to specify the column number in the control source in the txtbox. Remember that the column numbering is zero based, meaning that the first column is column(0). Here is an example that would work in the control source of a txtbox:

=[YourCombo].[Column](1)

"YourCombo" needs to be the actual name of your combobox. The would reflect the you want the second column of the Row Source to be linked to the txtbox.

HTH
RDH

Just the code I was looking for for months. Thanks a bunch. It worked for me.

Regards,
Ekmoorhead
 

eroyjenkins

New member
Local time
Today, 15:01
Joined
Jan 15, 2013
Messages
5
This is not working in a Web-compatible form. I am entering this as the control source for a textbox other than the combobox. It lists the first column if I just put the combobox name in the brackets without the column indicator. What is the right syntax for a web-compatible form to choose the second column to appear in another text box when the combobox selection is made?
 

MarkCX

New member
Local time
Today, 21:01
Joined
Jul 20, 2012
Messages
4
God bless forum contributors, the WWW and Google.

Just what I wanted. Found in seconds.

Thank you.
 

Casperaprel

New member
Local time
Tomorrow, 03:01
Joined
Nov 21, 2019
Messages
8
Hi, i'm asking how do i convert it from combo box item to list box

example my combo box control source is "IDSUMARRY '' and my row source is" SELECT tblProgram.ID, tblProgram.Project
FROM tblProgram;
"

how to convert to a text box. TQ
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:01
Joined
Oct 29, 2018
Messages
21,447
Hi, i'm asking how do i convert it from combo box item to list box

example my combo box control source is "IDSUMARRY '' and my row source is" SELECT tblProgram.ID, tblProgram.Project
FROM tblProgram;
"

how to convert to a text box. TQ

Hi. You should start your own thread, since this is a six (almost seven) year old thread.
 

Users who are viewing this thread

Top Bottom