【问题标题】:How to check values in a listbox and select certain rows如何检查列表框中的值并选择某些行
【发布时间】:2015-09-16 23:59:50
【问题描述】:

我发现了这个问题... EASY: vba: Looking through a listbox and selecting the contents 但它似乎选择了每个项目......不是很有用。

我需要加载已突出显示的现有值的弹出表单的 ListBox,以便用户能够添加或删除项目。

  For x = 1 To rs.RecordCount
    For Each ItemIndex In lbFA.?????
      If lbFA.ItemData(ItemIndex) = rs!FunctionalArea Then
        lbFA.Selected(ItemIndex) = True
      End If
    Next y
  Next x

lbFA.????? 区域中有什么?我认为这是我唯一缺少的部分。

【问题讨论】:

  • 您可以为 ItemIndex = 0 到 lbFA.listCount -1 执行标准 for 循环。这样,如果多列列表框 > lbfa.column(col_id, ItemIndex),您也可以从不同列获取值

标签: ms-access listbox vba


【解决方案1】:

您可以执行标准 for 循环 for ItemIndex = 0 to lbFA.listCount -1。这样,如果多列列表框 > lbfa.column(col_id, ItemIndex)

,您也可以从不同列获取值

【讨论】:

  • 知道了!谢谢...常规的 For 循环,而不是 For Each。
猜你喜欢
  • 2019-12-17
  • 2011-07-20
  • 1970-01-01
  • 1970-01-01
  • 2017-03-21
  • 1970-01-01
  • 1970-01-01
  • 2019-10-27
  • 1970-01-01
相关资源
最近更新 更多