0

在 Access 中,我试图从列表框中提取所选项目。

我已经有一段时间没有使用 List Box 对象了,但我似乎记得您必须遍历选定的项目,然后使用该List方法提取它们。

我的研究支持这种说法,但我遇到了与使用有关的问题List-

编译错误:找不到方法或数据成员

打印为每个选择返回的lstLocations.Selected(i)sees -1List显然不存在,那么如何提取所选值?

Dim i As Integer
For i = 0 To lstLocations.ListCount - 1
    If lstLocations.Selected(i) Then
        Debug.Print lstLocations.List(i)
    End If
Next i
4

1 回答 1

1

使用 for each 循环遍历所选项目。就像是

        Dim item As Variant
        For Each item In Me.lbx_booking.ItemsSelected
            If Not (Nz(Me.lbx_booking.Column(0, item), "") = "") Then

            End If
        Next item
于 2016-02-19T10:57:29.887 回答