Combo Box for two different fields

Mojo1

Board Regular
Joined
Mar 6, 2003
Messages
148
I want to create a combo box that will contain the Department and Department_Num in it. I have a table that has Department and Department_Num in it where I will draw the data from. I want to be able to have the values from the drop down go into each independent field when a new record is added.

Can some one help me with this one?
 
Here is what I have.

dbo_INV_INFSVC Table, which has a field Department and a field Dept_Num.

Only One Table!
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Alright, then, you will have to write a query that will capture these two fields off of this table and then base your record source for the combo off of this query. In the query, you need to change its Properties to "Unique Values"->Yes so that you'll only see each record once in the combo. I'm telling you, though, splitting this up into two tables is the way to go; what if you need to add a new department or delete a department from your current list?
 
Upvote 0
I have attached an error I get when I try to select a Department from the combo box.I got this before and corrected it, but this time I have duplicated everything and can not understand why I am getting it.

I have checked field length, I have made sure the columns are represented correctly with the After Update Event code.
Any Ideas?

Bill
 
Upvote 0
Hi Dugan
The way you showed the code:
"Private Sub Your_ComboBox_AfterUpdate()
Me.Your_Text1=Me.Your_ComboBox.Column(1)
me.Your_Text2=Me.Your_ComboBox.Column(2)
End Sub"
made it so easy to understand... I was wondering if you could show how to populate other areas from that same combo box... thats not included in the combo... but contains information about the subject...
meaning... I use the Combo box to lookup a name and it populates text1 and text2 (like above)... how do you get it to populate other text boxes that were not in the combo, but a part of the desired info... say that persons "city" ( to keep it elementary for me) to show up in the city box.
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,250
Members
451,757
Latest member
iours

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