ms訪問表單:組合框到多選下拉菜單 (ms access form: combobox to multiselect dropdown menu)


問題描述

ms訪問表單:組合框到多選下拉菜單 (ms access form: combobox to multiselect dropdown menu)

我有一個幾年前為我的公司製作的 ms 訪問數據庫。我正在嘗試將表單條目從組合框更改為多選組合框(複選框)。目前,只能保存一個值,我希望能夠保存多個值。

組合框的數據來自一個單獨的表。

在表單設置中,訪問只是讓我將組合框更改為列錶框或文本框,但這些選項都不允許我選擇多個值..

幫助。


參考解法

方法 1:

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

(by AlexWLGfx)

參考文件

  1. ms access form: combobox to multiselect dropdown menu (CC BY‑SA 2.5/3.0/4.0)

#Combobox #ms-access-forms #Database #multi-select #ms-access






相關問題

tcl/tk 小部件組合框失去焦點 (tcl/tk widget combobox loses focus)

Flex Combobox 奇怪的問題 (Flex Combobox strange problem)

在組合框中對齊文本 (Align Text in Combobox)

如何同時綁定到 ComboBox 中的兩個不同的依賴屬性? (How do I bind to two different dependency properties in a ComboBox at the same time?)

在綁定到字典的組合框中設置所選項目 (Setting selected item in combobox bound to dictionary)

easyUI datagrid內部編輯組合框無法選擇默認值 (easyUI datagrid inner edit combobox cannot selected default value)

VBA:數據輸入組合框有效,但命令按鈕給出“無效的屬性值”錯誤 (VBA: Data entry into combobox works, but command button gives "Invalid property value" error)

vb.net - 組合框總是選擇第一個值 (vb.net - combo box always select the first value)

打開 ComboBox DropDown 時不要選擇文本輸入 (Do not select text input when ComboBox DropDown is opened)

如何使用相同的數據源設置多個組合框? (How can I set up multiple combo-boxes with the same data source?)

如何使用 QtreeView 在 QComboBox 中設置所選項目 (How to set selected item in QComboBox with QtreeView)

Tkinter 組合框 Python (Tkinter Combobox Python)







留言討論