Break apart a Whole Name

M

Miles

I use A2003
===

I have a column or field named WholeName, e.g., Doe, John

How do I write an expression to break the WholeNames down into 2 columns:
LastName and FirstName, e.g., Doe and then John

Thank you
 
D

Douglas J. Steele

If you've always got the comma like that, then you can use the InStr, Left
and Mid functions:

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

You'd use the above as computed fields in a query: you shouldn't be storing
the information redundantly.
 
M

Miles

Thank you

Works beautifully

Will take heed of your admonition

Peace

Douglas J. Steele said:
If you've always got the comma like that, then you can use the InStr, Left
and Mid functions:

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

You'd use the above as computed fields in a query: you shouldn't be storing
the information redundantly.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Miles said:
I use A2003
===

I have a column or field named WholeName, e.g., Doe, John

How do I write an expression to break the WholeNames down into 2 columns:
LastName and FirstName, e.g., Doe and then John

Thank you
 
Top