列表框多值选择 [英] List Box multiple value selection

查看:183
本文介绍了列表框多值选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经根据查询输出创建的窗体。我已经使用了三个组合框和一个列表框。第一组合框给了我部的名单,对第二选择系的给我的那部(不同)的位置,第三个给我(不同),从该位置的项目,那么接下来就是列表框中谁显示了一些codeS项目。现在的问题是,我能够从列表中选择只有一个code和获取输出在Excel中。

I have created form based on query output. I had used three comboboxes and one list box. First combobox gives me list of Dept, selection of Dept on second gives me location of that Dept (distinct), the third gives me (distinct) project from that location, then next is list box who displays the some codes of that project. The problem is I am able to select only one code from that list and get output in Excel.

如果我想一次选择两个值,会怎么做呢?

If I wanted to select two values at a time, how would I do that?

如果我选择多选从列表框中财产不是我能选择多个值,但我没有得到输出。

If I select Multi Select from list box property than I am able to select multiple values but I am not getting output.

推荐答案

在一个列表框有多选属性设置为无,那么你可以检索选定值通过简单地参照

When a List Box has its Multi Select property set to "None" then you can retrieve the selected value by simply referring to

Me.List0.Value

然而,对于多选列表框控件,你需要遍历 ItemsSelected 集合,以确定被选定的项目:

However, for multi-select List Box controls you need to iterate through the ItemsSelected collection to determine the items that are selected:

Dim ItemIndex As Variant
For Each ItemIndex In Me.List0.ItemsSelected
    MsgBox Me.List0.ItemData(ItemIndex)
Next

这篇关于列表框多值选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆