Results 1 to 5 of 5
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    List box select all when clicking on asterisk

    Good morning all! I hope you are all well! I have a multi select list box, I would like the user to be able to click the asterisk (first choice in the box) to select all of the items. I'm using this code to select all on a separate button which works fine, but...thanks in advance for any insite you can provide!



    Code:
    Dim j
    
    With Me.List22
        For j = 0 To .ListCount - 1
             .Selected(j) = True
        Next
    End With

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,996
    If Me.List22 = "*" ??
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    If that doesn't work, and it may not with a multiselect listbox, I include the column property:

    Me.List22.Column(0)

    Using the appropriate zero-based column number. You might also need to test that the item is selected, as they may unselect it as well. I have code where I add/remove selections to a temp table as the user selects/unselects and I believe I test the selected status.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Quote Originally Posted by pbaldy View Post
    If that doesn't work, and it may not with a multiselect listbox, I include the column property:

    Me.List22.Column(0)

    Using the appropriate zero-based column number. You might also need to test that the item is selected, as they may unselect it as well. I have code where I add/remove selections to a temp table as the user selects/unselects and I believe I test the selected status.
    That did it! Thanks pbaldy!!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Filling a combox y clicking list box
    By Georgekobanda in forum Access
    Replies: 2
    Last Post: 05-08-2020, 08:29 AM
  2. Double Clicking a List Box
    By UT227 in forum Programming
    Replies: 3
    Last Post: 06-24-2018, 12:58 PM
  3. Replies: 3
    Last Post: 07-15-2015, 03:14 AM
  4. Replies: 14
    Last Post: 02-19-2013, 03:16 PM
  5. Replies: 1
    Last Post: 10-22-2010, 10:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums