Extract right part of a string
You could split it on the space: split(name, " ")(1) <- takes the second
part after the split.
You could use RIGHT and INSTR: Right(name, Len(name)-Instr(name, " ")) Or
Right(name, InstrRev(name, " "))
You could use MID: MID(name, Instr(name, " "))
Quote:
> Hi,
> I'm programming an Outlook contactform and have the following problem:
> I have a field where a full name is in. The Firstname is always the same
length,
> 4 characters.
> e.g.:
> Paul Miller
> Paul Ravenclaw
> Paul Smith
> Paul Graveyard
> Paul Hill
> etc.
> Now I need to cut off the first 5 characters from this field (Paul + " ")
with
> VBScript in the form, so that I can use the last name in other fields.
I've
> tried it with the REPLACE funtion but I couldn't get it to work. The
problem is
> the differnt length of the lastname.
> BTW: There is no other way to access the "lastname", because in reality it
isn't
> the name field, it's something different, I just took the name field for
> explanation purposes ;-)
> Can someone please give me a hint how to solve this problem with VBScript
or
> with formulas in Outlook fields?
> Thank you!!!
> Florian