Better/preferred Method to Populate Listboxs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #1

    Better/preferred Method to Populate Listboxs

    Which Method is Better or More Correct:
    Setup:
    Spit Database.
    A wizard style form:
    A table with all of the available… products (not inventory items which are products with serial numbers): (tbl_products)
    A table with all of the available… locations: (tbl_locations)
    Products can be assigned to locations so that they are “approved” for that location – call that table profiles (tbl_profile)
    Two queries:
    Qry_unassigned : This is the standard compare two tables (tbl_profile and tbl_products) and find unmatch records – where in this query takes a parameter from the form to filter by location against tbl_profile
    Qry_ProfileByLo cation: this query takes a parameter from the form to filter by location against tbl_profile

    Form, unbound, with a combobox using tbl_locations as the rowsource, the add-all, add-selected…. type buttons, and of course the two list boxes, a save, a reset, and cancel button. The afterupdate_eve nt of the location CBO fires the code to set the rowsource for the list boxes.

    For this alpha version of the application, what I’ve been doing is taking the results from the queries and then using the additem method to populate the two list boxes.
    In the past, what I’ve done is build a new table as a temporary hold where I added the returned records from each query with a yes/no box to indicate if the value should be in the left box or the right box and use this as the record source for the two boxes.
    IN either case, once the save button is clicked, the code deletes all records for the selected location from tbl_profile and then adds the records for the selected products for the selected location to tbl_profile; thus, creating the new profile for the location. It then forces the fom to update so the the current loction prfile is shown

    So, my question, which method of populating the listboxes is better/preferred or is there yet a better method?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    I should add:
    I'm reusing this basic form for several different but related options.
    (for example: the reverse of above, where instead of using the location in combobox, I use the product and then the locations show in the list boxes depending on if the product is currently allowed (right side) or not allowed (left side).)
    When Called I'm passing the data table names; thus, simple to pass a temporary table name too; however, in this case I might need multiple temporary tables... but that's a horse of another colour.
    Last edited by zmbd; Mar 12 '13, 03:28 PM.

    Comment

    Working...