Results 1 to 12 of 12
  1. #1
    Phred is offline Competent Performer
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    246

    Talking Multiselect Combo Box VBA General Information on Implelmentation.

    I have a Multiselect Combo box on a form. It allows multiple selections of Menu Categories for reports. I've been reading up on the Multiselect and the difficulties pulling the data into a usable string in VBA. Almost all of the articles are negative. Can anyone point me toward a resource on this? I need information on pulling the selection string into VBA and converting it to run a report. I don't have any specifics yet but would appreciate any direction.

    Thanks Fred

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I assume you meant multi-select ListBox since a ComboBox does not have that feature: http://www.fontstuff.com/access/acctut11.htm

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Actually, RG, a combobox can be setup to allow multiple selection. As long as the field in table has Lookup properties setup, the combobox on form will have a dropdown that has check boxes for multiple selections.
    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
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The software seems to be passing me by.

  5. #5
    Phred is offline Competent Performer
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    246
    I do have this in a combobox with the tables set up properly. The lookup works fine. The combo box appears fine on the screen. All options and check boxes are there. When you select they appear as comma delimited choices at the top of the combo box. I am looking for a way to pull it in to VBA and process it.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    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
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Quote Originally Posted by RuralGuy View Post
    The software seems to be passing me by.
    I don't think so. I suspect the OP is using a combo bound to the new "multivalued" field, which many experienced developers won't use anyway (me included).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Ahh...so it is a MultiValued field. No wonder I did not know about it. I do not even believe in the concept. For those that want them, fine.

  9. #9
    Phred is offline Competent Performer
    Windows XP Access 2010 (version 14.0)
    Join Date
    Dec 2009
    Posts
    246
    June7 and RG, I can take a hint! Thanks. I think I will take your words of wisdom and go down a different path.

    I don't know what it is yet but as Yogi Berra said, "When you come to a fork in the road, take it."

    A multiselect list box might also do for my client. It sounds like there might be a lot more support for it.

    My customer is a Meal Preparation company. They need to have something like a MultiSelect box to check the Categories of food being preped for the day. When they check the boxes in the list they can print out a "Pull Sheet" which tells them the ingredients to pull from inventory for the day's preparations.

    Do either of you have a suggestion that would serve the same purpose without the pain? I don't want to go down a new path only to find a Troll at the end. Am I mixing my metaphores or what!

    Phred

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I believe you have chosen wisely. How about a SubForm? You could add a CheckBox to each record and then print the "Pull Sheet" from the that. You could add the records to the SubReport from a ComboBox if you like and indlude a "delete" button on the records in case the user made a mistake. That is just btwo ideas that come to mind. I'm sure there are more you can think of.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    This might work for your "pull sheet" form/report:

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

  12. #12
    TheDuck65 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2012
    Posts
    1
    Below is some of the code we've been using at work to deal with multivalue combobox.

    Delete all records in selected tables shown of a multivalue combobox:
    Private Sub cmd_DoSomething_Click()
    Dim SelectedVals as Variant, i as Integer

    SelectedVals = me.MultiValueComboBoxName.Value ' finds the selected values and saves them as an array
    For i = 0 to UBound(SelectedVals) ' UBound finds the position of the last value in the array
    DoCmd.RunSQL "Delete " & SelectedVals(i) & ".* FROM [" & SelectedVals(i) & "];" ' assuming the combobox is a list of tables, _
    this deletes all records from each selected table
    ' Of course you could put any code in here you want to act upon your list. This could be where you run your reports.

    next i
    msgbox("All Actions Complete")
    End Sub

    Clear/Select all records in a multivalue combobox:
    Private Sub cmd_ClrSel_Click()
    Dim X(), i, j, SelectedVals
    ReDim X(0 To Me.ReportList.ListCount - 1)

    For i = 0 To Me.ReportList.ListCount - 1
    X(i) = Me.ReportList.Column(1, i)
    Next i

    SelectedVals = Me.ReportList.Value

    If IsNull(SelectedVals) Then
    Me.ReportList.Value = X
    Me.cmd_ClrSel.Caption = "Clear All"
    Else
    Me.ReportList.Value = Array()
    Me.cmd_ClrSel.Caption = "Select All"
    End If
    Me.Requery
    End Sub



    Quote Originally Posted by Phred View Post
    I have a Multiselect Combo box on a form. It allows multiple selections of Menu Categories for reports. I've been reading up on the Multiselect and the difficulties pulling the data into a usable string in VBA. Almost all of the articles are negative. Can anyone point me toward a resource on this? I need information on pulling the selection string into VBA and converting it to run a report. I don't have any specifics yet but would appreciate any direction.

    Thanks Fred

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

Similar Threads

  1. Multiselect Listbox
    By wwhit in forum Forms
    Replies: 19
    Last Post: 03-09-2015, 02:58 PM
  2. Listbox multiselect status
    By Sam23 in forum Programming
    Replies: 5
    Last Post: 03-06-2012, 01:13 PM
  3. Multiselect Listboxs
    By wwhit in forum Programming
    Replies: 3
    Last Post: 02-13-2012, 02:55 PM
  4. Replies: 12
    Last Post: 04-18-2011, 08:52 AM
  5. HELP! using list boxes with multiselect
    By tarhim47 in forum Forms
    Replies: 21
    Last Post: 11-08-2010, 02:51 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