Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there any way to unable a ListBox Row that already selected?

Status
Not open for further replies.

cuok

Programmer
Dec 24, 2001
201
Hi All!

HERE MY CODE THAN MY PROBLEM:

Private Sub List32_Click()
Dim frm As Form, ctl, ct As Control
Dim varItm As Variant, intI As Integer, ListD As Integer
Dim fldzmany As String

Set frm = Me
Set ctl = frm!List32


For Each varItm In ctl.ItemsSelected

For intI = 0 To ctl.ColumnCount - 1
If ctl.Column(intI, varItm) = Main1 Or ctl.Column(intI, varItm) = Main2 Or ctl.Column(intI, varItm) = Main3 _
Then MsgBox " Already in 3 main ": Exit Sub

fldzmany = fldzmany & ctl.Column(intI, varItm) & Chr(13) + Chr(10)

Next intI
Next varItm
MemoField = fldzmany

End Sub
======================= end code ===============

By this code the first 3 selected rows (can be the 5th,9th, 13th) of the (MultiSelect) ListBox goes to 3 fields : Main1,Main2,Main3 accordingly
the other clicked rows goes to memo field one after one

My problem is that i can't unable the 3 rows already had been choose .

the message stays to appear although i choose non of those 3 rows (because they still marked as "ItemSelected").

Is there any way to unable a ListBox Row that already selected?
the rowSource type is a table
the ListBox is MultiSelect=simple

Thanks in advance for your help

CUOK







 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top