Hi,
I am attempting to implement the 'Retrieve selected items in a multiple selection box' contained within the Microsoft Knowledge Base Article 827423 to allow a multiple selection and passing of selected data to a text box.
Initilly it seemed to work really well, but for some reason it has stopped and gives me an Overflow Error '6' and highlights the following line of code when i 'debug'
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 Long
sTemp = Nz(Me!SelectedDirectives.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!DirectivesList.ItemData(iListItemsCount)), Trim(sValue)) = 0 Then
Me!DirectivesList.Selected(iListItemsCount) = True
bFound = True
End If
iListItemsCount = iListItemsCount + 1
Loop Until bFound = True Or iListItemsCount = Me!DirectivesList.ListCount
sValue = ""
Else
sValue = sValue & sChar
End If
Next iCount
End Sub
I am using this facility to allow th euser to select a number of EU Directives that a piece of equipment has been tested against and this may be 1, 2 or more such directives.
I have implemented the 'Clear List' function by calling the function at appropraite times i.e. saving the record, next / previous record etc.
Can anybody shed any light on why this should start happening now?
Is there a more efficient / easier way of achieving this selection and transfer to a text box.
Many Thanks
Alan
I am attempting to implement the 'Retrieve selected items in a multiple selection box' contained within the Microsoft Knowledge Base Article 827423 to allow a multiple selection and passing of selected data to a text box.
Initilly it seemed to work really well, but for some reason it has stopped and gives me an Overflow Error '6' and highlights the following line of code when i 'debug'
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 Long
sTemp = Nz(Me!SelectedDirectives.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!DirectivesList.ItemData(iListItemsCount)), Trim(sValue)) = 0 Then
Me!DirectivesList.Selected(iListItemsCount) = True
bFound = True
End If
iListItemsCount = iListItemsCount + 1
Loop Until bFound = True Or iListItemsCount = Me!DirectivesList.ListCount
sValue = ""
Else
sValue = sValue & sChar
End If
Next iCount
End Sub
I am using this facility to allow th euser to select a number of EU Directives that a piece of equipment has been tested against and this may be 1, 2 or more such directives.
I have implemented the 'Clear List' function by calling the function at appropraite times i.e. saving the record, next / previous record etc.
Can anybody shed any light on why this should start happening now?
Is there a more efficient / easier way of achieving this selection and transfer to a text box.
Many Thanks
Alan