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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting sub-delimited items within a variable 1

Status
Not open for further replies.

Jamesm601

Programmer
Feb 6, 2004
27
US
Hi All!

Can anyone help me remember how to parse out a variable that contains dilimited and sub-delimited data? I thought either MID() or LEN() did that in VB, but I can't seem to get it to work.

Something along the lines of this:

Variable PATIENT contains the text "DOE,JOHN,C^34^M"

What I need to do is access the first "^" piece of the variable, then the second "," piece, arriving at "John".

I though I could do this with nested MID or LEN statements, but it doesn't seem to work. Any help jogging my aging memory would be greatly appreciated.

Thanks is advance.
 
Hi,
Try using the Split function is you're NOT running '97
Code:
FullName = Split(PATIENT, "^")(0)
FirstName = Split(FullName, ",")(1)


Skip,

[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue]


 
Skip,

Thank you very much. That worked nicely. I guess I'd imagined using MID or LEN for this. I've never heard of this function, but it works perfectly.

1 * 2 U
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top