ms access form: combobox to multiselect dropdown menu

Alex picture Alex · Mar 23, 2018 · Viewed 11.1k times · Source

I have an ms access db which was made a few years ago for my company. I am trying to change a form entry from a combobox to a multi-select combo box (Check box). Currently, only one value can be saved and I would like a number of values to be able to be saved.

The data for the combobox is sourced from a separate table.

In Form setting, access is only letting me change the Combobox to either a List box or a Text box, but neither of these options lets me select more than one value..

help.

Answer

WLGfx picture WLGfx · Mar 23, 2018

In your Combo/List boxes property sheet, go to 'Other' and set 'Multi Select' to 'Simple'. This allows the multi select.

In VBA, to get the count of the selected items, 0 for none use something like this:

count = Me.mycombo.ItemsSelected.Count

And then you can loop through each item to check if it is selected:

For i = 0 to Me.mycombo.ListCount - 1
    if Me.mycombo.Selected(i) = True then
        value = Me.mycombo.ItemData(i) ' gets the data
        ' DO STUFF WITH IT
    End If
Next i