Hello all,
I have a field of names that may or may not contain middle names and/or initials. Field content example is as follows:
Ramsey,Jonathan David
Smith,Elizabeth
No space before or after the comma... always a space between first and middle name/initial if there is one.I am trying to extract the first name to a field by itself. The following works as long as the name contains a space in it.
FName:Trim(Mid([NameString],InStr([[NameString],",")+1,InStr([NameString]," ")-(InStr(([NameString]),",")+1)))
It fails on the names that have no space or middle name/initial and prints #Error in the field. I am assuming some IIF statement is in order here. How can I take care of both situations and is there an easier or better way than what I have so far? Thanks in advance for any help!
I have a field of names that may or may not contain middle names and/or initials. Field content example is as follows:
Ramsey,Jonathan David
Smith,Elizabeth
No space before or after the comma... always a space between first and middle name/initial if there is one.I am trying to extract the first name to a field by itself. The following works as long as the name contains a space in it.
FName:Trim(Mid([NameString],InStr([[NameString],",")+1,InStr([NameString]," ")-(InStr(([NameString]),",")+1)))
It fails on the names that have no space or middle name/initial and prints #Error in the field. I am assuming some IIF statement is in order here. How can I take care of both situations and is there an easier or better way than what I have so far? Thanks in advance for any help!