Ricardo Caicedo
New Member
- Joined
- Aug 21, 2014
- Messages
- 43
I cannot figure out why the function InStr() is not working properly. I know that it does not work with different languages, but in my case is a simple find of a string inside other one.</SPAN>
I have two variables defined in the function as function(DBWord,CustWord)</SPAN>
StrWLow = LCase(DBWord)</SPAN>
StrNLow = LCase(CustWord)</SPAN>
And the part that It is not working is in red…………</SPAN>
If CustNumWords = 1 Then 'Just one word in the customer info</SPAN>
If StrComp(StrWLow, StrNLow, vbTextCompare) = 0 Then</SPAN>
WordMatch = 1</SPAN>
Else</SPAN>
If InStr(1,StrNLow, StrWLow, vbTextCompare) <> 0 Then</SPAN></SPAN>
WordMatch = 1</SPAN>
Else</SPAN>
K = Len(DBWord)</SPAN>
For i = 1 To K</SPAN>
NLetter = Mid(StrWLow, i, 1)</SPAN>
NxLetter = Mid(StrNLow, i, 1)</SPAN>
If NLetter = NxLetter Then</SPAN>
Accura = Accura + (1 / K)</SPAN>
WordMatch = Accura</SPAN>
i = i + 1</SPAN>
Else</SPAN>
i = i + 1</SPAN>
End If</SPAN>
Next i</SPAN>
End If</SPAN>
End If</SPAN>
Else 'more than one word in the customer info</SPAN>
J = 1</SPAN>
L = 1</SPAN>
K = Len(DBWord)</SPAN>
M = Len(CustWord)</SPAN>
End If</SPAN>
Any Help............
I have two variables defined in the function as function(DBWord,CustWord)</SPAN>
StrWLow = LCase(DBWord)</SPAN>
StrNLow = LCase(CustWord)</SPAN>
And the part that It is not working is in red…………</SPAN>
If CustNumWords = 1 Then 'Just one word in the customer info</SPAN>
If StrComp(StrWLow, StrNLow, vbTextCompare) = 0 Then</SPAN>
WordMatch = 1</SPAN>
Else</SPAN>
If InStr(1,StrNLow, StrWLow, vbTextCompare) <> 0 Then</SPAN></SPAN>
WordMatch = 1</SPAN>
Else</SPAN>
K = Len(DBWord)</SPAN>
For i = 1 To K</SPAN>
NLetter = Mid(StrWLow, i, 1)</SPAN>
NxLetter = Mid(StrNLow, i, 1)</SPAN>
If NLetter = NxLetter Then</SPAN>
Accura = Accura + (1 / K)</SPAN>
WordMatch = Accura</SPAN>
i = i + 1</SPAN>
Else</SPAN>
i = i + 1</SPAN>
End If</SPAN>
Next i</SPAN>
End If</SPAN>
End If</SPAN>
Else 'more than one word in the customer info</SPAN>
J = 1</SPAN>
L = 1</SPAN>
K = Len(DBWord)</SPAN>
M = Len(CustWord)</SPAN>
End If</SPAN>
Any Help............