Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Filling a listbox

Hi,
I have added a multi-column ListBox to a user form and need to fill it with
data using VBA/ADO
the data is retrieved into a recordset from SQL Server using this statement:
rst.open "select Id, Name, Address1 from Customers where name like
'abc%'", oconn

I am looking for something like lstCustomers.rowsource = rst, which does not
work here

Thanks in advance for your suggestions.
Regards
Habib


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Filling a listbox - update

I filled the contents of the recordset into range and used
Me.lstCustomers.RowSource = ("A26:B" & 26 + rs.RecordCount)
My listbox now has data.

However, I do not see all the columns, the columns are too wide

Me.lstCustomers.RowSource = ("A26:B" & 26 + rs.RecordCount)
Me.lstCustomers.ColumnCount = 12
Me.lstCustomers.ColumnWidths = "60 pt;72 pt;72 pt;72 pt;72 pt;36 pt;36
pt;36 pt;36 pt;36 pt;36 pt; 36 pt"
Me.lstCustomers.Width = 600


wht am I doing wrong?


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------
"HSalim[MVP]" wrote in message
...
Hi,
I have added a multi-column ListBox to a user form and need to fill it
with data using VBA/ADO
the data is retrieved into a recordset from SQL Server using this
statement:
rst.open "select Id, Name, Address1 from Customers where name like
'abc%'", oconn

I am looking for something like lstCustomers.rowsource = rst, which does
not work here

Thanks in advance for your suggestions.
Regards
Habib



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling a listbox whith recordset data LuisM[_2_] Excel Programming 4 July 31st 06 05:02 AM
filling userform listbox simonhall[_4_] Excel Programming 2 June 16th 06 01:43 AM
Filling a listbox with transpose of a range from an excel sheet viswanthank Excel Programming 2 June 9th 05 03:37 PM
Problem with Find filling a listbox vba farmer[_2_] Excel Programming 4 October 12th 04 06:55 PM
Filling a listbox depending on font index Trevor[_3_] Excel Programming 0 October 1st 03 08:25 PM


All times are GMT +1. The time now is 05:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"