Hello,
Im trying to extract some text from a text field.
For example if the value is " John" I need the expression to return me "John" or if the value is " John co. sth" I also need it to return me "John".
I tried this:
For " John" it returns the right result, but for " John co. sth" I get "co. sth".
Another thing I need is:
For "John" to return same "John" and for "John co. sth" to return also "John".
If I cant make one expression for all of this Im going to do it in VBA probably anyway so I would say something like if the first character is " " then the expression for the first example I gave, if not then for the second example.
I hope I have been clear enough
Thanks!
Im trying to extract some text from a text field.
For example if the value is " John" I need the expression to return me "John" or if the value is " John co. sth" I also need it to return me "John".
I tried this:
Code:
IIf(InStr(InStr(" John co. sth"," ")+1," John co. sth"," ") _
<>0, Right(" John ",Len(" John co. sth")-InStr(InStr(" John co. sth"," ")+1, _
" John co. sth"," ")),Right(" John co. sth",Len(" John co. sth")-InStr(" John co. sth"," ")))
For " John" it returns the right result, but for " John co. sth" I get "co. sth".
Another thing I need is:
For "John" to return same "John" and for "John co. sth" to return also "John".
If I cant make one expression for all of this Im going to do it in VBA probably anyway so I would say something like if the first character is " " then the expression for the first example I gave, if not then for the second example.
I hope I have been clear enough

Thanks!