Results 1 to 6 of 6
  1. #1
    Sam23 is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2011
    Posts
    3

    Listbox multiselect status

    I would like to programmatically change the ListBox.Multiselect property setting. Part of the time I want it set to "Extended" to open multiple documents. Other times I need the property set to "none".

    The following line causes error that property is being used improperly:

    Me.LstListBox.MultiSelect = 0 'none

    I tried both setting the focus off the listbox and on the listbox and neither option seems to resolve the issue.

    Thanks for the help.


    Sam

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Are you aware that the multiselect property can only be set in design view? From the sound of it, I'd probably leave it as multiselect and only allow the user a single selection programmatically under the appropriate circumstances.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Paul,

    " allow the user a single selection programmatically under the appropriate circumstances"

    How would you do this if you can only make the change in Design View?

    or rather how would you use this code scraped from VBA Help?
    Code:
    Forms("frm_Report_Menu").Controls("Lst_Filter").MultiSelect = 0

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No, I'd test like:

    If Me.ListboxName.ItemsSelected.Count > 1 Then

    which would tell you the user selected more than one item.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Thanks, I will use this in the future.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem; us Paul's have to stick together.
    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. Append Records using MultiSelect Listbox
    By Ted C in forum Programming
    Replies: 14
    Last Post: 03-15-2011, 01:25 PM
  2. Check Box status
    By NOTLguy in forum Forms
    Replies: 5
    Last Post: 11-27-2010, 08:59 PM
  3. HELP! using list boxes with multiselect
    By tarhim47 in forum Forms
    Replies: 21
    Last Post: 11-08-2010, 02:51 PM
  4. Forms + Multiselect list boxes
    By tarhim47 in forum Forms
    Replies: 0
    Last Post: 11-08-2010, 10:50 AM
  5. Replies: 3
    Last Post: 08-11-2009, 10:40 AM

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