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

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
563
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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)
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,533
Messages
6,120,076
Members
448,943
Latest member
sharmarick

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
Back
Top