Reversing name values in a field

G

Guest

Hi,

I have a field called CustomerName that has values that are last name,
first name. So there is a value of Smith, John which is John Smith. I want
to preserve the value in this field but create a new field called
CustomerName1 that has John Smith in it. It would need to somehow reverse
the values based on the comma delimeter and then get rid of the comma. Can
someone help?

Thanks,
 
G

Guest

LN = Left$(CustomerName, InStr(CustomerName, ",") - 1)
FN = Right$(CustomerName, Len(CustomerName) - InStr(CustomerName, ","))

-Dorian
 
G

Guest

Dorian,

Thanks for your help. How do I add the below code to an sql statement?

Thanks,
 
G

Guest

Use it in an update query.

I recommend you use two new fields and put first name in one and last name
in the other. You can always put them together when needed.
 
G

Guest

Karl is correct. There is no reliable way to parse the names accurately the
way you want. And, adding new names would be just as difficult. There are
too many name variations to consider.
As Karl said, create two fields, FirstName and Last Name. Carry your data
that way.
You can present them in any format you want.
 

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

Top