Results 1 to 4 of 4
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672

    Get List Box Selection From VBA


    I am trying to get the selected item from a list box using VBA, I tried to use
    Code:
    Me.lstAddedManually1.value
    but that does not work.

    The list box is called lstAddedManually1 and has the options of
    Code:
    Blue
    Red
    Green
    Pink
    No indexes or addtional rows. How can I use VBA to capture the selected value from that listbox?

  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,530
    If the listbox is multiselect, you'll need VBA code. What you have should work if it isn't. The code looks like:

    http://www.baldyweb.com/multiselect.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Quote Originally Posted by pbaldy View Post
    If the listbox is multiselect, you'll need VBA code. What you have should work if it isn't. The code looks like:

    http://www.baldyweb.com/multiselect.htm

    Ah that was it, I was not taking into account the value being null!

  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,530
    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. Multiple selection list box
    By Thompyt in forum Programming
    Replies: 6
    Last Post: 03-23-2015, 08:26 AM
  2. List Box Multiple Selection Against Query
    By fionny in forum Queries
    Replies: 3
    Last Post: 06-28-2013, 12:12 PM
  3. List Box Selection transfer
    By kulle in forum Programming
    Replies: 5
    Last Post: 08-16-2011, 11:59 AM
  4. Selection List for Query
    By Juan4412 in forum Queries
    Replies: 13
    Last Post: 01-09-2011, 05:59 PM
  5. Bring up record according to list box selection
    By dlewicki in forum Programming
    Replies: 4
    Last Post: 03-01-2010, 03:54 PM

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