ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   column headings for a list box from a recordset (https://www.excelbanter.com/excel-programming/366611-column-headings-list-box-recordset.html)

in-over-his-head-bill

column headings for a list box from a recordset
 
This is probably (and hopefully) simple, but my eyes are seeing blurry from
all the time in the help screens and I still can't find the solution.

I have a recordset . I have a multi-column list box with columnheads set to
true.
I have assigned values from the recordset to the list box as follows:
lst.Column() = rs.GetRows

How in VBA can I populate the column headings in the list box with the
column names in the recordset (e.g., rs(0).Name)

Thanks for any help.

Tom Ogilvy

column headings for a list box from a recordset
 
You can't. Only if you bind the listbox to data in the worksheet - this
means using the rowsource/listfillrange property.

--
Regards,
Tom Ogilvy


"in-over-his-head-bill" wrote:

This is probably (and hopefully) simple, but my eyes are seeing blurry from
all the time in the help screens and I still can't find the solution.

I have a recordset . I have a multi-column list box with columnheads set to
true.
I have assigned values from the recordset to the list box as follows:
lst.Column() = rs.GetRows

How in VBA can I populate the column headings in the list box with the
column names in the recordset (e.g., rs(0).Name)

Thanks for any help.


in-over-his-head-bill

column headings for a list box from a recordset
 
Thanks so much for the help. I will just throw some labels on top of the list
box with the recordset column names.

"Tom Ogilvy" wrote:

You can't. Only if you bind the listbox to data in the worksheet - this
means using the rowsource/listfillrange property.

--
Regards,
Tom Ogilvy


"in-over-his-head-bill" wrote:

This is probably (and hopefully) simple, but my eyes are seeing blurry from
all the time in the help screens and I still can't find the solution.

I have a recordset . I have a multi-column list box with columnheads set to
true.
I have assigned values from the recordset to the list box as follows:
lst.Column() = rs.GetRows

How in VBA can I populate the column headings in the list box with the
column names in the recordset (e.g., rs(0).Name)

Thanks for any help.



All times are GMT +1. The time now is 07:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com