Solved

datacombo box -> choosing more than one value?

Posted on 2000-04-25
3
209 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

730 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