VB Code:
Dim emplRS As New Adodb.Recordset
' sets the connection
Const connectStr = "Provider=SQLOLEDB.1;Data Source=MA0;database=ma00_app;uid=gsha;pwd=15;"
' set property to automatically create a connection
emplRS.ActiveConnection = connectStr
' open recordset with query for all records matching variable
emplRS.Open "select whsekey From timwarehouse where companyid = 'QCC' and whseid = '380'"
do while not emplRs.bof AND emplRs.eof
listbox1.additem emplRs.fields("nameoffield").value
emplRs.movenext
loop
emplRs.close