To trap the item name of more than one item selected in list control

5 pts.
Tags:
Microsoft Access
SQL
Visual Basic 6
1)Is it possible to trap the item name of more than one item selected in the list control?Then how?I wish to trap the item name of more than one item selected in the list/combo control with/without the help of index numbers of the item selected.

2)And then use this item name to pick up data related to the corresponding selected items from the database by using SQL query.

[strong]I have been using Vb 6.0 as a frontend and Ms Access as a backend to develop a small application.[/strong]



Software/Hardware used:
VB 6.0 and MS Access

Answer Wiki

Thanks. We'll let you know when a new response is added.

For your first requirement, you can use the SELECTED property.

You could move through the elments in the items array, and check whether they are selected or not.

Try this:

<pre>For i = 0 To List1.ListCount – 1
If List1.Selected(i) = True Then
MsgBox (List1.List(i))
End If
Next i</pre>

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    As for your second point, I don't really see a question there. Could you please tell us what exactly you need help with ?
    69,510 pointsBadges:
    report
  • msi77
    2) Maybe
    SELECT * FROM Table WHERE NAME IN (<list from list control>
    1,670 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following