Results 1 to 2 of 2

Thread: Paired List Boxes

  1. #1
    Join Date
    Dec 2004
    Posts
    1

    Paired List Boxes

    I am looking for the way to create paired list boxes for users to select from a list of names (preferably double-clicking on a line to select) and have it move the selected record into an adjacent list box. This would be similar to what the database wizards have for selecting tables or fields.

    I then need to append the selected records into a table with the order id and selected record id's. I.e. the appended table will have one record for each selected name with the order ID (from orders table) and CustomerID (from the main name table).

    I am trying to dupicate an old VB programmed front end and do not have access to the source code of the front end to learn from. Many searches on the web have turned up no examples to accomplish this. I know I can't be the first one looking to do this.

    Any help will be appreciated very much.

    Thank you!

  2. #2
    Join Date
    Sep 2003
    Location
    in my cube
    Posts
    95
    Try the attached. I've placed a boolean field, SelectedYN, in the underlying table that populates both listbox controls. I've used a recognizable approach for moving things back and forth between what's available to select and what's selected. I just flag the selected item as true, requery both lists, and the item "moves" from one list to the other.

    You can then add a command button that kicks off whatever query you like based on all items in the source table where SelectedYN=true.

    You'll see, in the source for the form, that I made clearing the selections optional (rem out one statement). This way, if you'd like to see your choices "stick" between sessions, you don't have to clear the items. I've set it up to run a query that updates all items in the source table to SelectedYN=false to "reset" the selections.

    Uses VB6 and ADO. Should be straightforward and hopefully sort of addresses the need.
    Attached Files Attached Files
    Last edited by xordevoreaux; 12-16-2004 at 03:29 PM.

Posting Permissions

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