Display the first field value of a combo box inside a textbox

Pookiemeister

Active Member
Joined
Nov 26, 2015
Messages
316
Office Version
  1. 365
  2. 2010
I am sorry if the title is confusing.
As of now, I have a table with an autonumber in the first field and Plant Names in the second field. On my form I have a disabled textbox and a combox that uses the table to populate it. In the property sheet, I have column count set to 2, column width set to 0.00125",1.1"(this only shows the second field in the combo box) and List Width=1.1".
Is there a way, depending on what is selected from the combo box, to display the first field value only in the textbox?

Thank you
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,273
Office Version
  1. 365
Platform
  1. Windows
Do you want to populate the textbox with the value from the first column of the listbox when a row is selected in the listbox?
VBA Code:
TextBox1.Value = ListBox1.List(ListBox1.ListIndex, 0)
 

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
2,058
Office Version
  1. 365
Platform
  1. Windows
The control with the list is a combo?
Me.YourTextBoxName = Me.YourComboName.Colum(0)
Use the AfterUpdate event of the combo. You might need something else as well if you're navigating records on a single record form.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,734
Messages
5,626,571
Members
416,192
Latest member
steinach

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top