Results 1 to 5 of 5
  1. #1
    Rendon115 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Oct 2019
    Posts
    10

    Drop down listbox, and or multiselect combobox

    Easy and quick question, Im sure there's an answer somewhere but google is failing me. I just need to have a multi select combobox (which I know you cannot do), so instead Im using a multiselect listbox. I just need to have the drop down arrow functionality of a combo box, its used with other parts of a form to filter our inventory. Can this be done with or without VBA?

    Sidenote: I have office 365, I updated the info for the forums, but I do not know how long it will take to update in my title block

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    with vba. the simplest solution

    1.size your listbox to 1 row high

    2. for the listbox got focus event put

    mylistbox.height=2000 'or whatever height you want in twips (567 twips=1cm)

    3. in the listbox lost focus event put

    mylistbox.height=250 'or whatever height you require

    note you can't hide the listbox scroll bars - even putting say a button over them doesn't work, and using them just scrolls, it does not change the listbox height

    Alternatively you could use a subform and build your own.That requires a lot more coding but does give you a lot more control

    EDIT: Just tested my suggestion - although it works in principle, the problem is the first row is displayed and is selected when clicked on. So additional code required in the gotfocus event to reverse the selection - so the gotfocus event bevomes

    List0.Selected(0) = Not List0.Selected(0)
    mylistbox.height=2000

  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,518
    Well, a listbox can't drop down, but I suppose you could alter its height, or visibility. You can actually have a multi-select combo, if it's bound to a multi-value field, but most of us recommend against their use.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Rendon115 is offline Novice
    Windows 10 Office 365
    Join Date
    Oct 2019
    Posts
    10
    @Ajax
    This works exactly how I want, and all I had to do was set the resize of the listbox as well when the user clicks in any area outside of where the listbox is. Thank you, its very much appreciated

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    happy to help

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

Similar Threads

  1. How to set Selected in multiselect listbox?
    By DavidFord in forum Access
    Replies: 11
    Last Post: 08-23-2019, 11:37 AM
  2. Multiselect Listbox
    By wwhit in forum Forms
    Replies: 19
    Last Post: 03-09-2015, 02:58 PM
  3. Listbox will work when multiselect=simple
    By ro88y09 in forum Forms
    Replies: 3
    Last Post: 02-25-2015, 11:10 AM
  4. Replies: 4
    Last Post: 06-24-2013, 07:34 AM
  5. Listbox multiselect status
    By Sam23 in forum Programming
    Replies: 5
    Last Post: 03-06-2012, 01:13 PM

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