I am currently using the following code to populate a list box with the contents of an ADODB recordset:
Is there a way to easily specify the column titles (I want the columns to have the same names that the fields in the recordset have)? Also, I'd like to automatically resize the ListBox so that it shows all the fields at once (i.e., no horizontal scroll bars). How about code for this?
Code:
Private Sub PopulateListBox()
With Me.lboxRecords
.ColumnCount = rsListBox.Fields.Count
.Column = rsListBox.GetRows
.ColumnHeads = True
End With
End Sub
Is there a way to easily specify the column titles (I want the columns to have the same names that the fields in the recordset have)? Also, I'd like to automatically resize the ListBox so that it shows all the fields at once (i.e., no horizontal scroll bars). How about code for this?