hello,
i am building a sql setence in order to query records in the field(descMaq) in a table (tblMaq),
assuming that my search string is: stTextoLibre= "BobCat S100"
i run the code to build this part of the sql statement
the code returns this string (stFiltro) that works correctly when running the new built query
Nevertheless I noticed that with this construction I miss some records, for example it will miss this "BobCat S 100", wich I would like to include so
I thought of splitting the string stTextoLibre by space, but in that case i would also get undesired records such as :
Caterpillar S 45
New Holland 465 S
is there a solution to include "BobCat S 100" and exclude Caterpillar S 45 ?
Thanks
i am building a sql setence in order to query records in the field(descMaq) in a table (tblMaq),
assuming that my search string is: stTextoLibre= "BobCat S100"
i run the code to build this part of the sql statement
Code:
While fincadena = False
i = i + 1
If Mid(stTextoLibre, i, 1) = " " Then
stTextoLibre = Left(stTextoLibre, i - 1) & _
"*'_AND_(tblMaq.descMaq)_LIKE_'*" & Right(stTextoLibre, Len(stTextoLibre) - i)
End If
If i = Len(stTextoLibre) Then
fincadena = True
End If
stFiltro = "(tblMaq.descMaq) LIKE '*" & stTextoLibre & "*'"
Wend
the code returns this string (stFiltro) that works correctly when running the new built query
Code:
(tblMaq.descMaq) LIKE '*bobcat*' AND (tblMaq.descMaq) LIKE '*s100*'
Nevertheless I noticed that with this construction I miss some records, for example it will miss this "BobCat S 100", wich I would like to include so
I thought of splitting the string stTextoLibre by space, but in that case i would also get undesired records such as :
Caterpillar S 45
New Holland 465 S
is there a solution to include "BobCat S 100" and exclude Caterpillar S 45 ?
Thanks