Results 1 to 6 of 6
  1. #1
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283

    Multi Select List Box

    Hello,

    I have a listbox names LstHello and you can select multiple states. I want to be able for it to select multiple states in the listbox and add it to a new record in the table and put all the values into one field separating it by a comma. The table name is "Users" and the field name is "States"

    Thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    So I'll start by asking what part of your issue has you stuck?

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Here's an example of part of your solution: http://www.baldyweb.com/MultiselectAppend.htm

  4. #4
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    that example adds a new record and inserts each value. I want to add all the values into one record. In one field, separating each value by a comma. I can't figure out how to get all the values into one record

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Maybe this link will give you some ideas: http://theaccessweb.com/forms/frm0007.htm

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Here's something I have archived, with your names inserted...see if it works for you:

    Code:
    Private Sub lstHello_AfterUpdate()
    
    Dim strNames As String
    
    Dim varItem As Variant
    
    For Each varItem In Me.lstHello.ItemsSelected
      strNames = strNames & Me.lstHello.ItemData(varItem) & ", "
    Next varItem
    
    Me.States = strNames
    
    End Sub

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

Similar Threads

  1. Replies: 1
    Last Post: 02-15-2016, 04:48 PM
  2. Replies: 15
    Last Post: 11-20-2013, 04:30 PM
  3. Replies: 5
    Last Post: 07-26-2012, 12:59 PM
  4. Multi select list box
    By foxtet in forum Forms
    Replies: 1
    Last Post: 05-30-2011, 02:13 PM
  5. Replies: 1
    Last Post: 10-22-2010, 10:11 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