473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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.
Jun 26 '08 #1
5 5272
ADezii
8,834 Expert 8TB
  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:
    Expand|Select|Wrap|Line Numbers
    1. Dim varItem As Variant
    2.  
    3. Me![cboReceive].RowSourceType = "Value List"      'Critical
    4.  
    5. If Me![lstSend].ItemsSelected.Count > 0 Then
    6.   For Each varItem In Me![lstSend].ItemsSelected
    7.     Me![cboReceive].AddItem Me![lstSend].ItemData(varItem)
    8.   Next varItem
    9. 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.
Jun 26 '08 #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:
    Expand|Select|Wrap|Line Numbers
    1. Dim varItem As Variant
    2.  
    3. Me![cboReceive].RowSourceType = "Value List"      'Critical
    4.  
    5. If Me![lstSend].ItemsSelected.Count > 0 Then
    6.   For Each varItem In Me![lstSend].ItemsSelected
    7.     Me![cboReceive].AddItem Me![lstSend].ItemData(varItem)
    8.   Next varItem
    9. 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.
Jun 27 '08 #3
ADezii
8,834 Expert 8TB
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...
Jun 27 '08 #4
NeoPa
32,556 Expert Mod 16PB
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.
Jun 27 '08 #5
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!
Aug 1 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Programatix | last post by:
Hi, I'm having problem with ComboBox. I'm trying to force the ComboBox select nothing by doing this, myCombo.SelectedText = "" myCombo.SelectedIndex = -1 but in vain, as the ComboBox will...
0
by: Susan Bricker | last post by:
The following error: "The current field must match the join key '?' in the table that seves as t the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the...
5
by: GTi | last post by:
Whats wring with this code? <select class=EditField size="1" name="PlantUnitID" title="Select line"> <option value="0" >Standalone Unit</option> <option value="1" selected >Connected Unit...
4
by: Drum2001 | last post by:
I have a combobox that is populated from a button on the form. One pushes this button and the following happens: !! = Me.ItemName So the combobox no shows whatever was in Me.ItemName. Here...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
1
by: neoupadhyay | last post by:
Hi Friends, I am using asp.net2.0 with C#, I have a probelm that, i wannt to Change the detailview item when i select the Combobox item. i.e select any item from combobox and the result related...
4
by: billa856 | last post by:
Hi, I want to know how can we set the value of Textbox = value of field in table when we select a value form combobx. example i have a table customer CID CNAME CSALARY 1 Billa ...
1
by: Wu | last post by:
Hello, I can not add a new items to combobox after the datasource was loaded. I usually do item.add(0,"--select") for dropdownlist at asp.net but it does not allow in window application in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.