Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
userform listbox cannot get listbox.value to transfer back to main sub | Excel Programming | |||
avoiding duplicates in listbox (added from another listbox) | Excel Programming | |||
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |