![]() |
Excel SQL and listbox
I have an Excel 2000 list from which I want to run a SQL statement to select
unique values (ie. with SELECT DISTINCT ). My question is, how can I fill a listbox with the resulting result list? I want to achieve this without pasting the unique values on a worksheet. Thanks for any help, Ravi |
Excel SQL and listbox
Ravi,
Use ADO. Set a reference to "MS Active Data Objects 2.x" Dim Conn As ADODB.Connection Dim RS As ADODB.Recordset Check the help about setting/creating a connection. Set RS=Conn.Execute(SQLString) As for adding, you loop through the RS, adding to the listbox List1.Clear With RS .MoveFirst List1.AddItem .Fields(1).Value .MoveNext End With NickHK "Ravi" bl... I have an Excel 2000 list from which I want to run a SQL statement to select unique values (ie. with SELECT DISTINCT ). My question is, how can I fill a listbox with the resulting result list? I want to achieve this without pasting the unique values on a worksheet. Thanks for any help, Ravi |
All times are GMT +1. The time now is 09:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com