Results 1 to 2 of 2

Thread: list box

  1. #1
    Join Date
    Oct 2003
    Posts
    11

    Angry Unanswered: list box

    I am using this select statment to populate a list box


    Set rs = db.OpenRecordset("SELECT ([name]) As [ManagersName] from [Employee]WHERE [Manager] ='" & PERSON & "';", dbOpenDynaset)

    TeamListBox.RowSource = rs!managersname


    The problem that i have is that this will find and populate the TeamListBox but it only puts one recold into the list box. How can i get it to add all the names with th matcing recolds.

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Re: list box

    Originally posted by shanecox
    I am using this select statment to populate a list box


    Set rs = db.OpenRecordset("SELECT ([name]) As [ManagersName] from [Employee]WHERE [Manager] ='" & PERSON & "';", dbOpenDynaset)

    TeamListBox.RowSource = rs!managersname


    The problem that i have is that this will find and populate the TeamListBox but it only puts one recold into the list box. How can i get it to add all the names with th matcing recolds.

    Thanks
    A recordset is a set of records.
    If you want it to populate a listbox, you should put rowsourcetype of the listbox to "Value List"

    Then walk through the recordset and add each record to the listbox.

    Code:
    do while Not rs.EOF
       listbox.addItem ......
       rs.moveNext
    Loop
    This is how I should do it. Maybe someone else has a better way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •