J
Joanne
Hello,
I have the following code which will look at the values typed into a text
box, determine whether or not there is more then one name, then create an
array if there is more than one name and put the results into a select
statement. It seemed to be working fine until I added the "Trim" line. Am I
not allowed to trim an array? The user may enter one name like "Harold Bloom"
or he may enter something like "Harold Bloom, Philip Roth". I need to remove
that space between the comma and "Philip Roth" so I used the Trim statement
but it keeps telling me the subscript is out of range. Thanks very much for
your help in advance.
If Len(Trim(vstrSearch)) > 0 Then
If vstrResult > 0 Then
straryElement = Split(vstrSearch, ",")
intFinalNumber = UBound(straryElement)
End If
For intCounter = 0 To intFinalNumber
straryElement(intCounter) = Trim(straryElement(intCounter))
If intFinalNumber > 0 Then
If intCounter = 0 Then
strSQLSearch = "'" & straryElement(intCounter)
Else
strSQLSearch = strSQLSearch & "' OR " & vTextHeading &
"='" & straryElement(intCounter) & "'"
End If
End If
Next intCounter
End If
I have the following code which will look at the values typed into a text
box, determine whether or not there is more then one name, then create an
array if there is more than one name and put the results into a select
statement. It seemed to be working fine until I added the "Trim" line. Am I
not allowed to trim an array? The user may enter one name like "Harold Bloom"
or he may enter something like "Harold Bloom, Philip Roth". I need to remove
that space between the comma and "Philip Roth" so I used the Trim statement
but it keeps telling me the subscript is out of range. Thanks very much for
your help in advance.
If Len(Trim(vstrSearch)) > 0 Then
If vstrResult > 0 Then
straryElement = Split(vstrSearch, ",")
intFinalNumber = UBound(straryElement)
End If
For intCounter = 0 To intFinalNumber
straryElement(intCounter) = Trim(straryElement(intCounter))
If intFinalNumber > 0 Then
If intCounter = 0 Then
strSQLSearch = "'" & straryElement(intCounter)
Else
strSQLSearch = strSQLSearch & "' OR " & vTextHeading &
"='" & straryElement(intCounter) & "'"
End If
End If
Next intCounter
End If