Getting listbox items to array using access VBA

試著忘記壹切 提交于 2020-01-13 16:22:08

问题


I have a listbox in access form. it contains 18 items . How do i store those itmes into array using access vba.


回答1:


The following will pull the contents of a listbox into an array and spit back out the contents.

Dim Size As Integer
Size = Me.List0.ListCount - 1
ReDim ListBoxContents(0 To Size) As String
Dim i As Integer

For i = 0 To Size
    ListBoxContents(i) = Me.List0.ItemData(i)
Next i

For i = 0 To Size
    MsgBox ListBoxContents(i)
Next i


来源:https://stackoverflow.com/questions/23278420/getting-listbox-items-to-array-using-access-vba

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!