Results 1 to 7 of 7
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Selecting all data from a List box (A2K - SR1)

    I have a form that contains several combo boxes and one list box. Each time the user changes a value in any combo box, several queries are run and data is dropped and re-inserted into a table. The table data is linked to the list box and refreshed after each combo box change (Sort of an online Query Writer). Based on the results of the list box, the user requires the functionality to select one, multiple, or all records to launch additional queries.

    Here are the questions. If the user selects one record, I can link a query to the record selected to get additional data
    1. Can the user select more then one record in a list box and if so, how?
    2. Can the user select all records in the list box and if so, how?
    3. If you can't select multiple or all records in a list box, is there another way to produce this functionality.
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Selecting all data from a List box (A2K - SR1)

    1. Can the user select more then one record in a list box and if so, how?

    Set the "MultiSelect" property to either Simple or Extended.
    -----------------------------------------------------------------------------------
    2. Can the user select all records in the list box and if so, how?

    Click on the first row of the listbox. Hold down Shift key, then click on last row.


    See Help for details.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Selecting all data from a List box (A2K - SR1)

    Mark's post answers your questions. However, the problem you'll encounter is that the value of a multiselect listboox with multiple selections isn't directly usable as criteria in a query. If you're doing all this manipulation in code, it won't be a problem.
    Charlotte

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Selecting all data from a List box (A2K - SR1)

    Thanks Mark and Charlotte.

    I will need to try this, however, I was wondering. How are the records accessed for a multiselect listbox. For instance, if the listbox is identified as Listbox1 and the user selects 10 of a total of 20 records, how is the multiple data stored so you can access each record?

    Ultimately, I will need to write code that will work similar to an IN statement... Where the data in a query is IN the results of the listbox. Your input is greatly appreciated (as always)

    <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>
    Regards,

    Gary
    (It's been a while!)

  5. #5
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Selecting all data from a List box (A2K - SR1)

    Mark and Charlotte,

    I found some code in an older Post that should let me complete the programming. I will re-post a question if the programming doesn't work. Thanks again for your help.

    Gary
    Regards,

    Gary
    (It's been a while!)

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Selecting all data from a List box (A2K - SR1)

    Gary,
    have a look at <A target="_blank" HREF=http://www.mvps.org/access/forms/frm0007.htm>this</A> from The Access Web
    Francois

  7. #7
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Selecting all data from a List box (A2K - SR1)

    Francois,

    Thanks for the info. I did something very similar to the example provided in your link.

    Gary
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

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