Try this:Function FirstName(pData As String)iPos1 = InStr(pData, " ")If iPos1 = 0 ThenFirstName = pDataElseFirstName = Left(pData, iPos1 - 1)End IfEnd Function