Populate listbox with disconnected recordset?

  • Thread starter Thread starter Webtechie
  • Start date Start date
W

Webtechie

I have a spreadsheet which has several tables. I create a name and then
populate the listboxes on my userforms from these tables.

'Populate the listbox
'********************
lastRow = wks.Range("aq1").End(xlDown).Row
Set FoundRng = wks.Range("aq2:bg" & lastRow)

With FoundRng
.Name = "DataFoundTable"
End With
With frmValidate
.lstSearch.RowSource = "data!DataFoundTable"
End With

Now I need to move my data out of the workbook and into Access tables. I've
been studying, but I'm not seeing what to do with my listboxes from all the
books.

1) If I move my data to Access, do I need to bring the data back into Excel
to populate a listbox?

(Use .copyfromRecordset into a range and then use that range for the
listbox?)

2) Is it possible to populate a listbox from a disconnected recordset?

Thanks.

Tony
 
Don't use CopyRecordset, Use GetRows to put them into an array and then
populate the listbox from the array

ary = rs.GetRows
Listbox.List = ary
 
I should have mentioned that you need to transpose the array

ListBox1.List = Application.Transpose(ary)
 
An Important part of this I failed to mention is that my listboxes normally
have about three columns.
 
Bob,

Does this bring in multiple columns?

Tony

Bob Phillips said:
I should have mentioned that you need to transpose the array

ListBox1.List = Application.Transpose(ary)

--
__________________________________
HTH

Bob
 
Back
Top