Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract up to a comma and then what is left

Status
Not open for further replies.

acorbally

Programmer
Jan 9, 2001
65
US
I want to extract text from a field up to a comma and then extract what is left. Any suggestions?

Data sample

From this format into this.............
Field1 Field 1 Field 2
Jones, Dave Jones Dave
Peterson, Julia Peterson Julia
Anderson, Thomas Anderson Thomas
 
There are a few ways. If there is only one comma, then this is what I suggest:

strLastName = Left(strTest, InStr(strTest, ","))
strFirstName = Right(strTest, Len(strTest) - Instr(strTest, ",") + 1)

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top