On Tue, 13 Oct 2009 19:12:17 -0700 (PDT), GM Leonric
There is indeed no way to do this without making some assumptions and
living with the consequences. Two-word names are simple, but
three-word ones are not:
Mary Jane Smith
Hillary Rodham Clinton
You have to decide whether the first one word or first two words
constitute the firstname, and live with the fact you'll sometimes get
it wrong.
I recommend documenting all your rules, checking them for consistency,
and then implementing them. Personally I would rather write the rules
in VBA then in SQL:
select GetFirstName(FullName) from SomeTable
public function GetFirstName(byval FullName as string) as string
-Tom.
Microsoft Access MVP
I'm redoing a database and need to make the Name field, which now contains
the First Name AND Last Name in one field. I need to split the names up so
they are each in their own separate fields ie: First Name and a 2nd field for
Last Name. Is there an easy way to do this?
Yup as long as the names are pretty standard and you don't have people
like John Von De Grot (where Von De Grot is the last name).
FirstName: Left(Trim([Field]),InStr(Trim([Field])," "))
LastName: Mid(Trim([Field]),InStrRev(Trim([Field])," ")+1)
Keven