Connect to Oracle Database through ODBC with VBA
Cnn="DSN=mysysdsn;UID=mydb;PWD=mypwd"
Sql="Select distinct(mycol) as mycol from mytable
Set ADORS=CreateObject("ADODB.RecordSet"
ADORS.Open Sql,Cn
MyValues = ADORS.GetRow
MyValues now is a array (0 based): you can loop through lbound(myValues) to ubound(myValues) to populate the list box
NOTE: The Cnn and Sql strings will be specific to your PC/Database: change these as appropriate. If you needed to, you can use the MSDAORA provider instead of the DSN.
|