splitting a name field

Roni Sutton

Registered User.
Local time
Today, 22:37
Joined
Oct 18, 1999
Messages
68
I have an imported table with a name field in the last, first format. I need to go through each record and split the first and last names into two different fields. Each name contains a comma, but of course, each last name is a different length. I have created blank fields to store the last and first names, I'm just not sure how to get the data to them using code.

Thanks for any help!!

Roni
 
Try using the InStr function to find the comma and then take the data to the left and right of it.
 
SELECT tblClients.Name, Left([name],InStr([name],",")-1) AS LName, Trim(Mid([name],InStr([name],",")+1)) AS FName FROM tblClients;
 
Thanks guys! It is wonderful to know that this stuff doesn't just go away. I used the first reply that I got back when I first posted this and it worked wonderfully. However, I can ALWAYS use microsoft articles and SQL statements. This forum is such a wealth of information. I'm so glad I found it.

Thanks again!

Roni
 

Users who are viewing this thread

Back
Top Bottom