Solved

datacombo box -> choosing more than one value?

Posted on 2000-04-25
3
204 Views
Last Modified: 2010-05-02
I have data combo box
let say table persone  wich has 2 field code and name
in my program i have combo box that shows the name
when a person select the name it stores the code in database.

Is there a way with datacombo to select more than one value.
I want to be able to select 2 or 3 persones and store their code in database
Did any of you guys encounter this before???

can you give me small code example for 50 points?
0
Comment
Question by:jerbell
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
scj1 earned 50 total points
ID: 2747994
The data combo only allows single selections. However, using the normal list control with the multi-select property set to True will allow mutliple selections.

The data list doesn't support multiple selections because it is designed to be bound to a single field (the bound column).

I hope that helps. Incidently, using the onClick and onSelectionChange events you can effectively create the same sort of illusion as data binding (obviously via use of a recordset object) - use the itemData value to store the data you want to bind.

I hope that helps somewhat...

Cheers,

StuJ
0
 
LVL 1

Expert Comment

by:scj1
ID: 2748016
Oh, code:
'init listbox
private sub initListBox
 list1.multiselect = true
 with rs 'recordset
  do while not .eof
    list1.additem !itemNameField
    list1.itemData(list1.newIndex) = !itemDataToBind
    .moveNext
  loop
 end with
end sub

'Event
Private Sub List1_Click()
  dim i as integer
  for i = 0 to list1.listcount -1
   if list1.selected(i) then
     'appropriate code to say this is
     'selected
   end if
  next i
End Sub
0
 

Author Comment

by:jerbell
ID: 2748047
thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question