Display combo box value in a text box

stimpy

New member
Local time
Today, 09:46
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
 
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
 
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
 
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
 
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?
 
God bless forum contributors, the WWW and Google.

Just what I wanted. Found in seconds.

Thank you.
 
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, 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

Back
Top Bottom