Name Column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I received a database with the Full Names in one column. Is there a way to seperate them into 2 columns for First and Last Name?
 
***************************************
Dim i as integer
Dim strLastName, strFirstName as string
For i = 1 to Len(FullName)
strFirstName = strFirstName & mid(FullName,i,1)
if mid(FullName,i,1) = " " then
strFirstName = Trim(strFistName)
strLastName = Trim(mid(FullName,i,Len(FullName)-i)
End If
Next i
*****************************************
You will need to add a method or reading the FullName and
storing the split name.
-----Original Message-----
I received a database with the Full Names in one column.
Is there a way to seperate them into 2 columns for First
and Last Name?
 
I received a database with the Full Names in one column. Is there a way to seperate them into 2 columns for First and Last Name?

Well, yes... BUT.

How do you intend to handle these names:

Madonna ' that's her full name
John Wilkes Booth ' last name Booth
Christina Zeta Jones ' last name Zeta Jones
Hans van der Steen ' last name van der Steen

Leaving these exceptions for manual handling, you can:
- create new FirstName and LastName fields
- run an Update query updating FirstName to

Left([fullname], InStr([fullname], " ") - 1)

and

LastName to

Mid([fullname], InStr([fullname], " ") + 1)

with a criterion of

LIKE "* *"

on the fullname field to prevent errors if there is no blank.
 
Back
Top