Separating Names

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

Guest

I have a field that contains that is in the following format:
[lastname],[firstname] (no spaces)

I need to somehow separate the two and put the lastname into a field called
Last and the firstname into its own separate field called first. Is there
some magical code that will accomplish this?
 
Melanie said:
I have a field that contains that is in the following format:
[lastname],[firstname] (no spaces)

I need to somehow separate the two and put the lastname into a field called
Last and the firstname into its own separate field called first. Is there
some magical code that will accomplish this?


You can use InStr function to find the comma. Then Left and
Mid to get the two parts:

LastName: Left(fullname, InStr(fullname, ",") - 1)
FirstName: Mid(fullname, InStr(fullname, ",") + 1)
 

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

Back
Top