Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox w/ ADO 2

Status
Not open for further replies.

DK47

Programmer
Jun 3, 2003
118
0
0
US
This code loads the symbols from the ado recordset just fine.
Can anyone tell me how to allow only unique items to be loaded? In otherwords, even if there are several records with the same symbol, the user only needs to see it once.



adoSymbols.RecordSource = "SELECT (Symbol) FROM Holdings WHERE Investor_Number = " & frmStartPage.txtInvestorNumber
adoSymbols.Refresh

With adoSymbols.Recordset
Do Until .EOF
lstSymbols.AddItem .Fields(0)
.MoveNext
Loop
End With

Thanks,
Dwight
 
you could try SELECT DISTINCT in your SQL. That way it will only grab symbols once.
 
Change your SQL statement by adding the keyword 'Distinct'. Try,

Code:
adoSymbols.RecordSource = "SELECT DISTINCT (Symbol) FROM Holdings WHERE Investor_Number = " & frmStartPage.txtInvestorNumber


Take Care,

zemp

"If the grass looks greener... it's probably because there is more manure."
 
Thanks Guys,
That was easy enough.
Regards,
Dwight
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top