使用Access VBA将列表框项目添加到数组 [英] Getting listbox items to array using access VBA

查看:592
本文介绍了使用Access VBA将列表框项目添加到数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在访问表单中有一个列表框。它包含18个项目。

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

推荐答案

下面将把列表框的内容拉入数组并

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

这篇关于使用Access VBA将列表框项目添加到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆