如何在MS Access中将默认选择设置为列表框

时间:2017-03-16 17:39:23

标签: ms-access access-vba ms-access-2010

我在MS Access 2010中有一个多选ListBox。在表单加载时,我想要值"增量资金"自动选择。这是怎么做到的?

1 个答案:

答案 0 :(得分:1)

尝试这样的事情:

With MyListBoxName
    .SetFocus
    For x = Abs(.ColumnHeads) To (.ListCount - 1)
        If (.ItemData(x) = "Incremental Funding") Then
            .Selected(x) = True
            MsgBox (.Selected(x))
        End If
    Next
End With