Results 1 to 7 of 7
  1. #1
    googalabosh is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    48

    Feeding a multiple multi-value list boxes to a single summary field

    I have a form that has more than one multi-value list box. Each list contains 10 values. I want to feed the selected values into one field that shows all selected values from all of the list boxes. How do I do this?

    For example:
    List Box A
    -A1
    -A2
    -A3
    List Box B
    -B1
    -B2
    -B3
    List Box C
    -C1
    -C2
    -C3


    List Box D
    -D1
    -D2
    -D3

    User chooses values A2, B3, and D1. A summary field below the list boxes reads:

    Summary: A2; B3; D1

    TIA!

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    see if this will do what you want
    http://allenbrowne.com/func-concat.html
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    So each listbox is set for Single select? Just an expression in textbox:
    Code:
    = 
    [listboxA] & ";" & 
    [listboxB] & ";" & 
    [listboxC] & ";" & 
    [listboxD]
    (The forum made that one line of code into multiple lines, can't seem to correct.)

    That does assume a selection will be made in each listbox. Dealing with possibility of no selection gets complicated to prevent extra ;'s - build a VBA custom function.

    If listbox is multi-select, loop through each listbox ItemsSelected and concatenate. Looping multi-select listbox items is a common topic http://allenbrowne.com/ser-50.html

    Or as suggested by Micron, use Allen Browne's ConcatRelated function to concatenate table data. Record would have to first be committed to table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Here's 3 listboxes, multi-select
    Click image for larger version. 

Name:	mslbxex.png 
Views:	14 
Size:	7.1 KB 
ID:	48881
    Attached Files Attached Files
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Code:
    = listboxA] & ";" & listboxB] & ";" & listboxC] & ";" & listboxD]
    Accidentally clicked submit instead of preview. Anyway, the cause seems to be the leading [. As soon as I use one, the line wraps, even when not using code tags. Forum shouldn't do that.

    =
    [listboxA] & ";" &
    [listboxB] & ";" &
    [listboxC] & ";" &
    [listboxD]
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    If you want to loop listbox bound to multi-value field, adjust code to reference column index 1 instead of 0.

    strlist = strlist & Me.List0.Column(1, (varSelected)) & ","
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    googalabosh is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    48
    Quote Originally Posted by Micron View Post
    Code:
    = listboxA] & ";" & listboxB] & ";" & listboxC] & ";" & listboxD]
    Accidentally clicked submit instead of preview. Anyway, the cause seems to be the leading [. As soon as I use one, the line wraps, even when not using code tags. Forum shouldn't do that.

    =
    [listboxA] & ";" &
    [listboxB] & ";" &
    [listboxC] & ";" &
    [listboxD]
    Thank you! Something this simple is exactly what I was looking for!

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

Similar Threads

  1. Replies: 44
    Last Post: 01-18-2021, 11:12 AM
  2. Replies: 4
    Last Post: 03-13-2016, 12:48 PM
  3. Replies: 7
    Last Post: 06-04-2013, 01:10 PM
  4. Replies: 3
    Last Post: 03-01-2013, 05:36 PM
  5. Replies: 1
    Last Post: 03-01-2009, 09:53 AM

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