string function to split name field into 2 seperate fields

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.
 
F

fredg

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top