I'm struggling to find a way to fill a Listbox on an Access Form with the contents of an Array that I'd build in a VBA routine.
Through searches, I've gotten as far as building a long string and assigning it to the rowsource for the Listbox. Not pretty IMO for my final solution.
I made a Listbox with 5 columns then I do this:
It works, but my real list will be close to 400 rows long.
Is there a way to assign a two-dimensional array to the Listbox in one statement. I can do this on an Excel Userform, but am struggling with my inexperience in Access.
I tried similar routines as above, building an array full of values and then trying to assign it to control source and rowsource to no avail. I tried looping through the listbox.column(c-1,r) with no luck.
The Data that will comprise the 400 rows is an extrapolation of a set of static variables out through time. Building the results with some simple looping in VBA is quite effective for the task. I just can't seem to figure out how to display my results in a listbox on an access form so that the user can scroll through the list.
Any pointers most welcome.
Thanks,
Shred.
Through searches, I've gotten as far as building a long string and assigning it to the rowsource for the Listbox. Not pretty IMO for my final solution.
I made a Listbox with 5 columns then I do this:
Code:
Private Sub Form_Load()
Dim r As Integer, c As Integer
Dim strRowsource As String
For r = 1 To 10
For c = 1 To 5
strRowsource = strRowsource & (r * c) & ", "
Next c
Next r
Me.lboxBreakdown1.RowSource = strRowsource
End Sub
It works, but my real list will be close to 400 rows long.
Is there a way to assign a two-dimensional array to the Listbox in one statement. I can do this on an Excel Userform, but am struggling with my inexperience in Access.
I tried similar routines as above, building an array full of values and then trying to assign it to control source and rowsource to no avail. I tried looping through the listbox.column(c-1,r) with no luck.
The Data that will comprise the 400 rows is an extrapolation of a set of static variables out through time. Building the results with some simple looping in VBA is quite effective for the task. I just can't seem to figure out how to display my results in a listbox on an access form so that the user can scroll through the list.
Any pointers most welcome.
Thanks,
Shred.