S
Stockwell43
Hello,
On my form I have a multi-select List box. This is the code I am using from
Microsofts website:
Private Sub Form_Current()
Dim oItem As Variant
Dim bFound As Boolean
Dim sTemp As String
Dim sValue As String
Dim sChar As String
Dim iCount As Integer
Dim iListItemsCount As Integer
sTemp = Nz(Me!AddInfo.Value, " ")
iListItemsCount = 0
bFound = False
iCount = 0
Call clearListBox
For iCount = 1 To Len(sTemp) + 1
sChar = Mid(sTemp, iCount, 1)
If StrComp(sChar, ",") = 0 Or iCount = Len(sTemp) + 1 Then
bFound = False
Do
If StrComp(Trim(Me!NamesList.ItemData(iListItemsCount)),
Trim(sValue)) = 0 Then
Me!NamesList.Selected(iListItemsCount) = True
bFound = True
End If
iListItemsCount = iListItemsCount + 1
Loop Until bFound = True Or iListItemsCount =
Me!NamesList.ListCount
sValue = ""
Else
sValue = sValue & sChar
End If
Next iCount
End Sub
I got 12 records in the database and I got run time error '6' Overflow and
it higlighted this sentence of the code in yellow:
iListItemsCount = iListItemsCount + 1
Does this mean I am limited to so many selections? I have never used a list
box before.
Thanks!!
On my form I have a multi-select List box. This is the code I am using from
Microsofts website:
Private Sub Form_Current()
Dim oItem As Variant
Dim bFound As Boolean
Dim sTemp As String
Dim sValue As String
Dim sChar As String
Dim iCount As Integer
Dim iListItemsCount As Integer
sTemp = Nz(Me!AddInfo.Value, " ")
iListItemsCount = 0
bFound = False
iCount = 0
Call clearListBox
For iCount = 1 To Len(sTemp) + 1
sChar = Mid(sTemp, iCount, 1)
If StrComp(sChar, ",") = 0 Or iCount = Len(sTemp) + 1 Then
bFound = False
Do
If StrComp(Trim(Me!NamesList.ItemData(iListItemsCount)),
Trim(sValue)) = 0 Then
Me!NamesList.Selected(iListItemsCount) = True
bFound = True
End If
iListItemsCount = iListItemsCount + 1
Loop Until bFound = True Or iListItemsCount =
Me!NamesList.ListCount
sValue = ""
Else
sValue = sValue & sChar
End If
Next iCount
End Sub
I got 12 records in the database and I got run time error '6' Overflow and
it higlighted this sentence of the code in yellow:
iListItemsCount = iListItemsCount + 1
Does this mean I am limited to so many selections? I have never used a list
box before.
Thanks!!