Reversing name values in a field

  • Thread starter Thread starter Guest
  • Start date Start date
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,
 
LN = Left$(CustomerName, InStr(CustomerName, ",") - 1)
FN = Right$(CustomerName, Len(CustomerName) - InStr(CustomerName, ","))

-Dorian
 
Dorian,

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

Thanks,
 
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.
 
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.
 
Back
Top