Sad Der
accessd666 at yahoo.com
Thu Jan 22 02:47:25 CST 2004
Hi group,
I've got an app (A2k) and I use a lot of check boxes
to select all listbox items. Can someone please help
me how I can transform the code to a function?
I found this in the HELP. But I cannot figure out how
I can combine the SET and a parameter?!
Sub BoundData()
Dim frm As Form, ctl As Control
Dim varItm As Variant
Set frm = Forms!Contacts
Set ctl = frm!Names
For Each varItm In ctl.ItemsSelected
Debug.Print ctl.ItemData(varItm)
Next varItm
End Sub
I think I need 2 params:
Form
Listbox
Here's my code:
Dim intCountItems As Integer
Dim x As Integer
intCountItems = lstTabellen.ListCount
If chkAllTabellen.Value = -1 Then
For x = 0 To intCountItems - 1
With lstTabellen
If Not .Selected(x) Then
.Selected(x) = True
End If
End With
Next x
Else
For x = 0 To intCountItems - 1
With lstTabellen
If .Selected(x) Then
.Selected(x) = False
End If
End With
Next x
End If
End Sub
TIA
SAD
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/