How to make two columns from one where first name and last name is separated by comma?

N

Ned Bec

Hi everybody,
I need to split field "NAME" which looks like Doe, John in two fields
"LastName" (Doe) and "FirstName" (John) in order to make new table with the
fields LastName and FirstName.
Please help.
Thank you in advance
Ned
 
C

crashix

Assuming all names are LN, FN -- try a make table query and split the name by
using instr() and left() and right() functions.

LastName: Left([name],InStr([name],",")-1)
FirstName: Right([name],Len([name])-InStr([name],",")-1)
 
J

John Vinson

Hi everybody,
I need to split field "NAME" which looks like Doe, John in two fields
"LastName" (Doe) and "FirstName" (John) in order to make new table with the
fields LastName and FirstName.
Please help.
Thank you in advance
Ned

Use the string handling functions to create calculated fields:

LastName: Left([NAME], InStr([NAME], ",") - 1)
FirstName: Trim(Mid([NAME], InStr([NAME], ",") + 1)

John W. Vinson[MVP]
 
Top