Can you show me how that would like in my IF statement example.
On Jul 17, 5:56 pm, lbsstacey <lbssta...@discussions.microsoft.com>
wrote:
> Can you show me how that would like in my IF statement example.
>
[quoted text clipped - 14 lines]
> > Sounds like you want INSTR(). Then you can search for a string inside
> > of something and have your code respond accordingly.
InStr() returns a number, the position of one string inside another.
If it's >0 then it's in there.
straight from the help file...
Dim SearchString, SearchChar, MyPos
SearchString ="XXpXXpXXPXXP" ' String to search in.
SearchChar = "P" ' Search for "P".
' A textual comparison starting at position 4. Returns 6.
MyPos = Instr(4, SearchString, SearchChar, 1)
' A binary comparison starting at position 1. Returns 9.
MyPos = Instr(1, SearchString, SearchChar, 0)
' Comparison is binary by default (last argument is omitted).
MyPos = Instr(SearchString, SearchChar) ' Returns 9.
MyPos = Instr(1, SearchString, "W") ' Returns 0.
so you'd just have something like
IIf(Instr(1, SearchString, SearchChar,0)>0, "True Part", "False Part")