Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004

    Unanswered: insert results of query into list box

    I was wondering how to populate a list box with the results of a query???

  2. #2
    Join Date
    Feb 2004
    One Flump in One Place
    3 ways off the top of my head:

    1) Pop the a SQL statement referring the query into the row source (the wizard guides you through this)
    2) Populate an ADO recordset. Set the cursor location to the client. Set the recordset as the listbox recordset.
    3) As 2 but instead of assiging the recordset, use the ToString method to get a deliminated list of values, set the listbox to value list and pop the string in the row source.

    1 is probaby your best bet though
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2004
    The first option worked, however I have a search form where a user might type in part of an address, then the query would filter only the records that match. The way it is now, the list box is showing all records (not the filtered query results).

  4. #4
    Join Date
    Apr 2004
    outside the rim
    So you need an After_Update on the text box where the user types in part of the address.

    The event takes the whatever the user typed, adds an asterisk before and after it, creates a string containing the SQL statement, whch includes the clause
    "Where tblSource.Addess Like '" & strFilter & "'"
    Set that string to the Rowsource property of the combo box and requery it. The list is now limited to entries including the value the user typed in.


Posting Permissions

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