Link to home
Start Free TrialLog in
Avatar of Bob Schneider
Bob SchneiderFlag for United States of America

asked on

VB6 ListBox Question

Sorry...but I need to know this...

I want to know how to select all items in a list box returned by a query.   There could be nothing, one, or more than one item that needs to be selected.  Here is my query (it is selecting nothing):

    Set rs = New ADODB.Recordset
    sql = "SELECT ir.RacesID, r.RaceName FROM IndRslts ir INNER JOIN Races r ON ir.RacesID = r.RacesID "
    sql = sql & "WHERE ir.RosterID = " & lPartID & " AND ir.MeetsID = " & lMeetID & " ORDER BY r.ViewOrder"
    rs.Open sql, conn, 1, 2
    Do While Not rs.EOF
        lstRaces.Text = rs(0).Value & "-" & rs(1).Value
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing

Open in new window


Thank you in advance...
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Schneider

ASKER

Awesome.  Thanks!
Make sure you have the latest version of the code that I just posted because I think I was changing it while you accepted my answer.

In any case, you're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
It worked so I think we are good.  I will review it however.