how to select more than one item from a combobox...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aquarius4u
    New Member
    • Jun 2008
    • 6

    how to select more than one item from a combobox...

    hi,

    How can i select more than one item from a combobox and transfer it to another combobox.... and save it as a record both in form and table.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    1. Only List Boxes allow the multiple selection of items contained within them, so for purposes of this demo, change the first Combo Box to a List Box, and name it lstSend.
    2. Rename the receiving Combo Box cboReceive.
    3. Set the MultiSelect Property of lstSend to either Simple or Extended, but not None.
    4. Select as many items as you wish in lstSend.
    5. Execute the following code to transfer the selected items in lstSend to cboReceive:
      Code:
      Dim varItem As Variant
      
      Me![cboReceive].RowSourceType = "Value List"      'Critical
      
      If Me![lstSend].ItemsSelected.Count > 0 Then
        For Each varItem In Me![lstSend].ItemsSelected
          Me![cboReceive].AddItem Me![lstSend].ItemData(varItem)
        Next varItem
      End If
    6. These items will still be accessible in lstSend but will now be visible in cboReceive also (appended to existing items). The new items transferred to cboReceive are not added to the RowSource of cboReceive.

    Comment

    • aquarius4u
      New Member
      • Jun 2008
      • 6

      #3
      Originally posted by ADezii
      1. Only List Boxes allow the multiple selection of items contained within them, so for purposes of this demo, change the first Combo Box to a List Box, and name it lstSend.
      2. Rename the receiving Combo Box cboReceive.
      3. Set the MultiSelect Property of lstSend to either Simple or Extended, but not None.
      4. Select as many items as you wish in lstSend.
      5. Execute the following code to transfer the selected items in lstSend to cboReceive:
        Code:
        Dim varItem As Variant
        
        Me![cboReceive].RowSourceType = "Value List"      'Critical
        
        If Me![lstSend].ItemsSelected.Count > 0 Then
          For Each varItem In Me![lstSend].ItemsSelected
            Me![cboReceive].AddItem Me![lstSend].ItemData(varItem)
          Next varItem
        End If
      6. These items will still be accessible in lstSend but will now be visible in cboReceive also (appended to existing items). The new items transferred to cboReceive are not added to the RowSource of cboReceive.

      Thanks for the help,
      however i want the transfer data to be displayed in the combo box and the same to reflected in the table, so that we can generate report from there.... the data need to be saved on the daily basis, so the combobox should hold the values for future reference as saved records.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by aquarius4u
        Thanks for the help,
        however i want the transfer data to be displayed in the combo box and the same to reflected in the table, so that we can generate report from there.... the data need to be saved on the daily basis, so the combobox should hold the values for future reference as saved records.
        You will have to provide much more information than that which you have supplied, such as:
        1. Sending List Box Name.
        2. Receiving Combo Box Name.
        3. Table Name to save the transferred data to.
        4. Field Name in Table which will accept the transferred data.
        5. Row Source of List Box.
        6. Row Source of the Combo Box.
        7. etc...

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32661

          #5
          WHAT??

          You've just been told that ComboBoxes don't support multiple selections, yet you still want someone to tell you how to use multiple selections from a ComboBox. Am I missing something here?

          I think you need to learn to express what you want more clearly, or learn to pay attention to what someone says before rushing on to demand more help. One or the other is needed.

          ADMIN.

          Comment

          • NJonge01
            New Member
            • Jun 2007
            • 44

            #6
            ADezii, your answer to this question is most helpful to me.

            One thing unique about my situation is that I'm not adding to the other list box, I'm building a string of criteria for a SQL Search Screen (which leverages logic I built based on other help from this board!).

            Just wanted to give props that your answer kept me from having to post a question.

            Thanks!

            Comment

            Working...