string function to split name field into 2 seperate fields

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

Guest

Can anyone help me with a string function that splits a name field into 2
seperate fields. In the column name every name is entered with LastName
FirstName and I ned to move the LastName and the FirstName into seperate
fields.
I think it can be accomplished by using the InStr function but I have no
idea where to start. Any help is most appreciated.
 
Can anyone help me with a string function that splits a name field into 2
seperate fields. In the column name every name is entered with LastName
FirstName and I ned to move the LastName and the FirstName into seperate
fields.
I think it can be accomplished by using the InStr function but I have no
idea where to start. Any help is most appreciated.

You can run an Update Query.

What is the name separator?
A space? Brown John

Update YourTable Set YourTable.LastName =
Left([FullName],InStr([FullName]," ")-1),YourTable.FirstName =
Mid([FullName],InStr([FullName]," ")+1)

or a comma and space? Brown, John

Update YourTable Set YourTable.LastName =
Left([FullName],InStr([FullName],", ")-1),YourTable.FirstName =
Mid([FullName],InStr([FullName],", ")+2)
 
Back
Top