S
Santiago Gomez
I would like to have one text box where the user can type any number of
words separated by commas, and then Split them into an array so I can create
WHERE statements to go with my query.
If I used the Split function though, it separates words by spaces, so a
valid 2-word search term will become useless as 2 separate words.
Something like this:
txtFilterCriteria : oranges, apples, orange cake
should split words into:
oranges
apples
orange cake
so that I can build a SQL statement :
If Me.txtFilterCriteria <> "" Then
strSQL = strSQL & " AND "
x = Split(Me.txtFilterCriteria)
For i = 0 To UBound(x)
strSQL = strSQL & "(a.[Notes #1]) " & sqlCriteria & "'*" & x(i) &
"*' " & sqlOperator & " "
Next i
'trim strSQL string to remove trailing OR/AND
While (Not (Right(strSQL, 1)) = "'")
strSQL = Left(strSQL, Len(strSQL) - 1)
Wend
End If
thanks
words separated by commas, and then Split them into an array so I can create
WHERE statements to go with my query.
If I used the Split function though, it separates words by spaces, so a
valid 2-word search term will become useless as 2 separate words.
Something like this:
txtFilterCriteria : oranges, apples, orange cake
should split words into:
oranges
apples
orange cake
so that I can build a SQL statement :
If Me.txtFilterCriteria <> "" Then
strSQL = strSQL & " AND "
x = Split(Me.txtFilterCriteria)
For i = 0 To UBound(x)
strSQL = strSQL & "(a.[Notes #1]) " & sqlCriteria & "'*" & x(i) &
"*' " & sqlOperator & " "
Next i
'trim strSQL string to remove trailing OR/AND
While (Not (Right(strSQL, 1)) = "'")
strSQL = Left(strSQL, Len(strSQL) - 1)
Wend
End If
thanks