Populate Unbound text box based on combo box

spectraflame

Well-known Member
Joined
Dec 18, 2002
Messages
830
Office Version
  1. 365
Platform
  1. Windows
I have a combo box that lists all part numbers in our inventory. Since most of our people know the numbers by memory, it is only listing the numbers. I would like to go a head and display the item desription next to the part number in a text box just for visual purposes. I do not need to store this information in a table.

The combo box is based on a query for all part numbers based on department. Is it possible to use something like VLOOKUP to look up the part number in the query and return the description in the unbound text box?

Matthew
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Matthew

If you don't need to store the information in a table where is it going to come from?
 
Upvote 0
The description of the inventory item is pre-defined in the inventory table. I do not need to store the inventory description in the main table that I am using because the inventory item number, the number in my combo box, will be stored there.

I can see your point though. If it would be easier to store the information in the table, I do not have a problem with that at all. It would make reporting and creating other forms a lot easier if the information was in the main table but I just did not think it was necessary.

Matthew
 
Upvote 0
Matthew

I didn't realise you actually had an inventory table.

And it would not make sense to store that data in your table.

For one it would violate normalization rules and it would increase the size of your database.

The way you have it currently set up is fine.
 
Upvote 0
I guess that was my initial question. How do I go about setting this up?

Would I just place =[Inven1].Column(3) in the Control Source for my text box with Inven1 being my combo box and the 3rd column being the full item descritption?

Matthew
 
Upvote 0
Hi Matthew.
If I am reading your question correctly, this is a standard feature of Access. Base your combo box on a query that has both the number and description, you can set the column count of the combo box to "2" to display both columns, you can then set the "bound" column to the one with the number and store that number in the control source you are currently using. If you re-create the combo box based on a query with the number and name the wizard will help you get what you want.
HTH, Andrew. :)
 
Upvote 0
Hi Matthew, expanding on the last 2 responses:

Andrew's method means there is no need to use a separate textbox. Set the column widths in the combo to 1;0;1.5 (inches, I'm assuming) and the List Width to 2.5 -- this way you'll see the code and the description in the combo list.

Alternatively, you can use the AfterUpdate eevent of the combo to push the value to your text box, and leave it so the combo only displays the code. Assuming the textbox is txtDesc, this code should do it:

[txtDesc] = [Inven1].Column(2) 'columns start at 0, so this is 3rd col

Insert that into the After Update event of the combo and give it a whirl

Denis
 
Upvote 0
I understand what you are telling me to do, but when I place the following code in the After Update event of my combo box, it gives me an error stating that the INVENDESC1 macro cannot be found. INVENDESC1 is the name of the text box that I am trying to populate. INVEN1 is the name of the combo box.

[InvenDesc1] = [Inven1].Column(1)

What am I doing wrong?

Matthew
 
Upvote 0

Forum statistics

Threads
1,221,900
Messages
6,162,691
Members
451,782
Latest member
LizN

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