Solved

datacombo box -> choosing more than one value?

Posted on 2000-04-25
3
198 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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now