Link a text box to a combo box control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I have a combo box, cboControl and I want a text box to show the value so
it doesn't look like you can change it using the combo box, what is the code
for outputting column 2 of cboControl to a textbox txtControl.
I tried Me.txtControl = Me.cboControl.Column (2) but that didn't work, any
suggestions?
 
The Column collection starts counting at 0, so the second column would be
Me.cboControl.Column(1)
 
hi,
If I have a combo box, cboControl and I want a text box to show the value so
it doesn't look like you can change it using the combo box, what is the code
for outputting column 2 of cboControl to a textbox txtControl.
I tried Me.txtControl = Me.cboControl.Column (2) but that didn't work, any
suggestions?
Use as ControlSource for your Textbox "=cboControl.Column(2)", no VBA
needed.

Hint: if you have two columns in your Combobox then the index is Column(1).


mfG
--> stefan <--
 
twen said:
If I have a combo box, cboControl and I want a text box to show the
value so it doesn't look like you can change it using the combo box,
what is the code for outputting column 2 of cboControl to a textbox
txtControl.
I tried Me.txtControl = Me.cboControl.Column (2) but that didn't
work, any suggestions?

ComboBox columns are numbered starting with zero so you actually need Column(1).
Also you don't need any code. Just use...

=cboControl.Column(1)

....as the ControlSource of the TextBox.
 

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

Back
Top