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
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