On 24 Nov 2005 23:55:50 -0800, "Piotr" <ho***@wp.pl> wrote:
Hi,
Im trying to write a query which takes part of the string for example:
peter_Poland
michael_German y
I wish to get output:
peter
michael
regards
Piotr
If strName is the holder for the above names, then using:
mid(strName,1,i nstr(1,strName, "_")-1)
will give you the first name.
Note that this will only work as long as the underscore character
actually exists in the strName holder. If it doesn't, the function
will give you an error. A way around it, if that is a possibility, is
to do:
Iif(instr(1,str Name,"_")=0,"", mid(strName,1,i nstr(1,strName, "_")-1))
but this isn't needed if your data always has an underscore in it.
mike