Question : Parse name and Id

I have a column of data that I need to parse the data is in the following format:
Guess, Franklin (4444)
Doe, John (X1111)
Doe Gegco, Don (3454)

I need to parse the information to the left of the comma as the lastName
I need to parse the informaton from the right of the comma as the firstName
I need to parse the Number that is located between the ( ) as  Employee number
Using a query and updating a table with this information.  The file has thousands of this format.
I would appreciate any help.  Thank you

Answer : Parse name and Id

Hi frank,

The query below dices up the single field entry with Mid, Trim, and InStr functions. It should do the trick for you. Just subtitue the actual field name and table names for FullName, tblFullName, and tblDividedName.

Regards,

carazuul

1:
2:
SELECT Mid([FullName],1,InStr(1,[FullName],",")-1) AS [Last Name], Trim(Mid([FullName],InStr(1,[FullName],",")+1,InStr(1,[FullName],"(")-InStr(1,[FullName],",")-2)) AS [First Name], Mid([FullName],InStr(1,[FullName],"(")+1,InStr(1,[FullName],")")-InStr(1,[FullName],"(")-1) AS EmployeeID INTO tblDividedName
FROM tblFullName;
Open in New Window Select All
Random Solutions  
 
programming4us programming4us