Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting listbox items to array using access VBA

Tags:

vba

ms-access

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

like image 559
vuyy1182 Avatar asked Jun 05 '26 16:06

vuyy1182


1 Answers

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
like image 190
KevenDenen Avatar answered Jun 08 '26 08:06

KevenDenen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!