Help! Listbox and combo values into 1 table row

inkbird1

Board Regular
Joined
Apr 21, 2020
Messages
51
Hi, does anyone have any idea how to get values from a multiselect list box and values on the userform from multiple combo boxes into one row in a table?
i have a multiselect listbox of student names on a userform. On this userform I have 2 x combo boxes the user can select values from.
I need to get these into a row in tbl_1 the selected listbox values AND the combobox

Thanks for any help!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
FWIW, putting field values across in a record like this is what you do in Excel, not in a relational database. So I question whether or not you should even do this.

I presume
- you're wanting to do this on a regular basis and not just one time
- this is an Access form because you posted in Access forum. It's not an Excel userform (Access forms are not called userforms).
- the number of values you want to put into a table record (again, assuming this is an Access table, so record, not row) might be different each time.

If my assumptions are correct, then I can only see this working if you use code to loop over the ItemsSelected collection:

and if the listbox has multiple columns, you might need to worry about that as well.

The last assumption in the above list would complicate this a bit. If that number can fluctuate you won't be able to use sql statement in code. You'd have to know the count of the selected items and edit the fields of a recordset by their ordinal position (number position) because you'd never know which field names to use. If you ever modified the position of the fields in the table you'd mess this up.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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