NEED HELP ON THE STRING ..... ACCESS 97

H

Hung.cao

How do i get the return value to see if string1 is a park of string 2.


for example.
String1 = "Penn"
String2 = "I live in penn harrisburg"
I like to get the return true since string1 is in string 2

String1 = "Texas"
String2 = "I live in penn harrisburg"
I like to get the return false since string1 is not in string 2

does anyone have a function or any ideal how to do it ? Please advice
and thank you in advange. I need this to mainternance my table instead
open the table to manual fixing it.
 
G

Graham R Seach

Hung,

Use the Instr() function. Check the online Help for information.
If Instr(1, String2, String1) > 0 Then
'String1 is in String2
End If

....or you can use this function:
Public Function IsItInThere(String2Search As String, String2LookFor As
String) As Boolean
IsItInThere = (Instr(1, String2Search, String2LookFor ) > 0)
End Function

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Top