【问题标题】:Extract selected rows from a Listbox in Access从 Access 中的列表框中提取选定的行
【发布时间】:2016-02-19 10:49:48
【问题描述】:

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

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

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

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

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

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

【问题讨论】:

    标签: ms-access listbox multi-select ms-access-2016


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 2014-10-06
      • 2018-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多