Text Functions to Retrieve Strings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to retrieve the string between the 1st and 2nd occurance of the
underscore _ character. Sample string is
ALL-REGIONS_65959_2007_07_Detail.csv.
Here's what I've got so far.

Mid$([FileName],InStr([FileName],"_")+1,5)

How do I get it to retrieve all characters between the 1st and 2nd underscore?
 
What you have should do it unless all records do not have exactly 5 character
between the two underscores.

Try this ---
Left(Right([FileName],Len([FileName])-InStr([FileName],"_")+1),InStr([FileName],"_")-1)
 
Back
Top