none
Drop-Down List in Access

    Question

  • This seems like it must be simple, but I've yet to find a way to do it: I need a Drop-Down list in an Access form.

    By "Drop-Down list" I do NOT mean a ComboBox (distinction available at http://msdn.microsoft.com/en-us/library/aa511458.aspx - for .NET) - that is, I don't want a cursor in the box. I just want the users to be able to select from some pre-defined options. They should not be able to type in the field. It basically just needs to function like a ListBox, but the list needs to drop down (space is at a premium).

    Any assistance would be much appreciated. Thanks in advance!

     - Sean

    Friday, October 29, 2010 3:36 PM

Answers

  • Hi Sean

    After reading Gina’s post I think I may have misunderstood what you required.
    How about a locked textbox with a button beside it.

    Create a hidden listbox under the textbox. In the click event of the cmd button make the listbox visible, set the focus to the listbox. In the after update event of the listbox, set the focus to the cmd button and then make the listbox hidden.

     


    Hope this helps Bob Fitz BizSoftware If this answer solves your problem, please check, Mark as Answered. If this answer helps, please click the Vote as Helpful button.
    • Marked as answer by Bessie Zhao Friday, November 05, 2010 8:55 AM
    Friday, October 29, 2010 4:13 PM
  • Just for you...  (You did not say which version of Access.  The sample works with Access 2007 or Access 2010.)

    http://www.access-diva.com/f6.html

    ...I did end up using a List Box because I could not achieve the effect with a Combo Box.


    --
    Gina Whipp
    2010 Microsoft MVP (Access)

    Please post all replies to the forum where everyone can benefit.
    • Marked as answer by Bessie Zhao Friday, November 05, 2010 8:55 AM
    • Edited by Gina Whipp MVPMVP Monday, October 24, 2011 2:23 AM Updated link
    Friday, October 29, 2010 8:56 PM
  • Hi,

    You may have learnt from the answers so far, that there is no dropdown
    other than combobox within the onboard controls of Access.

    A slightly different workaround than Gina's and Bob's:

    - Create a listbox, one line high.
    - Create a button next to the listbox to simulate the arrow.
    - On Button_Click increase the listbox height and set focus on it. Do the
    same on Listbox_Click.
    - On Listbox_Exit decrease the height to one line again.


    Peter Doering [MVP Access]

    • Marked as answer by Bessie Zhao Friday, November 05, 2010 8:55 AM
    Friday, October 29, 2010 9:31 PM

All replies

  • Only one thing comes to mind...

    Create you combo box and shrink so only thing showing is drop down arrow.  Place a text box right next to the the drop down arrow and make it equal to the combo box contents and lock it so Users can't click in the text box.  Now, Users can click the drop down arrow, select form the list and not get into the text box.

    Just because I am curious, why is it a problem for Users to click in the box?  As long as it's set up not to allow additions a drop down box really isn't much different then a combo box.


    --
    Gina Whipp
    2010 Microsoft MVP (Access)

    Please post all replies to the forum where everyone can benefit.
    Friday, October 29, 2010 4:00 PM
  • Hi Sean

    I could not find the web page you sited but if I've understood what you want how about this:

    Create a hidden listbox and a visible cmd button. In the click event of the cmd button make the listbox visible, set the focus to the listbox and make the cmd buton hidden. In the after update event of the listbox make the cmd button visible, set the focus to the cmd button and then make the listbox hidden.

     

     


    Hope this helps Bob Fitz BizSoftware If this answer solves your problem, please check, Mark as Answered. If this answer helps, please click the Vote as Helpful button.
    Friday, October 29, 2010 4:00 PM
  • Hi Sean

    After reading Gina’s post I think I may have misunderstood what you required.
    How about a locked textbox with a button beside it.

    Create a hidden listbox under the textbox. In the click event of the cmd button make the listbox visible, set the focus to the listbox. In the after update event of the listbox, set the focus to the cmd button and then make the listbox hidden.

     


    Hope this helps Bob Fitz BizSoftware If this answer solves your problem, please check, Mark as Answered. If this answer helps, please click the Vote as Helpful button.
    • Marked as answer by Bessie Zhao Friday, November 05, 2010 8:55 AM
    Friday, October 29, 2010 4:13 PM
  • Thanks for the help, everyone! I'll give your suggestions a try. It seemed like such an obvious feature, I was just hoping there would be some internal Access feature that allowed me to do this.

    The reason it's a problem to allow typing in the box without allowing additions is due to the way the program will be used (for data entry during interviews). There will be a couple thousand of these list boxes, and whenever you type in something that isn't in the list, Access produces an error message. It's not a huge problem - more annoying than anything else!

    Thanks again...

     - Sean

    Friday, October 29, 2010 4:53 PM
  • Actually, you could supress that message by writing some code to handle it and placing your own message or nothing at all.
    --
    Gina Whipp
    2010 Microsoft MVP (Access)

    Please post all replies to the forum where everyone can benefit.
    Friday, October 29, 2010 5:36 PM
  • Just for you...  (You did not say which version of Access.  The sample works with Access 2007 or Access 2010.)

    http://www.access-diva.com/f6.html

    ...I did end up using a List Box because I could not achieve the effect with a Combo Box.


    --
    Gina Whipp
    2010 Microsoft MVP (Access)

    Please post all replies to the forum where everyone can benefit.
    • Marked as answer by Bessie Zhao Friday, November 05, 2010 8:55 AM
    • Edited by Gina Whipp MVPMVP Monday, October 24, 2011 2:23 AM Updated link
    Friday, October 29, 2010 8:56 PM
  • Hi,

    You may have learnt from the answers so far, that there is no dropdown
    other than combobox within the onboard controls of Access.

    A slightly different workaround than Gina's and Bob's:

    - Create a listbox, one line high.
    - Create a button next to the listbox to simulate the arrow.
    - On Button_Click increase the listbox height and set focus on it. Do the
    same on Listbox_Click.
    - On Listbox_Exit decrease the height to one line again.


    Peter Doering [MVP Access]

    • Marked as answer by Bessie Zhao Friday, November 05, 2010 8:55 AM
    Friday, October 29, 2010 9:31 PM