Access VBA get two values from ComboBox

Hi

I have a ComboBox as shown in the image below.
There is  Listbox below it.
I want to get the Part Number which is the first part of the ComboBox item and then the Description, which is the second
part of the item and add a new row to the ListBox where the Part Number goes into the first column and the Description goes into the second part of the List Box. What VBA code would I use?

1
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
The combo should be bound to a table rather than a value list.  It will be easier to manage.  To add a new row, you would add the data to the RowSource table and then requery the combo.
Me.cboPart.Requery

What is the bound column of the combo?  If it is Part, then Part will automatically be stored in the control if the control is bound.  You can reference other columns of the combo's RowSource by using its .Column property.  The columns are a zero based array so the first column is 0

Me.SomeControl = Me.cboPart.Column(0)

The second is 1

Me.SomeControlSecondColumn = Me.cboPart.Column(1)

etc.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thank you
PatHartmanCommented:
You're welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.