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

Extracting a string from a field 1

Status
Not open for further replies.

Developer2U

Programmer
Nov 25, 2005
28
US
I need to do some string concatenation to build a dynamic string to populate a report.

What I need to extract out is the "for DR " information out of the field. The word after for could be any number of characters in length. For example, it could be "for TRR" or "for DR/TRR" etc.

Thanks in advance.
 
I am assuming I would somehow combine the Mid$ and the Instr functions, but not sure how to do it in this case.
 
forWhat: Mid([the field],4+InStr([the field],'for '))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Great job PHV, you're making me look like a genius. It worked quite well. What I don't understand is the 4 ...is that taking the length of 'for ' into account?
 
exactly, as the instr returns the position of the f.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top