You can use Instr to get the start and end points and then do some math.
Personnally, I would write a VBA function to do this using the split function.
This gets the position of the start tag
Instr(1,[MemoField],"StartTag")
This gets the position of the end tag
Instr(1+Instr(1,[MemoField],"StartTag"),[MemoField],"EndTag")
So combining all that into an expression using MID should return the desired
value if it exists. No guarantee that I got the math right or all the
parentheses correctly placed/matched.
MID([MemoField]
,Instr(1,[MemoField],"StartTag")+ Len("StartTag")
,Instr(1+Instr(1,[MemoField],"StartTag"),[MemoField],"EndTag")
-Instr(1,[MemoField],"StartTag") - Len("StartTag"))
To be Safe you should test the memo field to see if the tags exist before you
even try to parse out the string.
IIF([MemoField Like "*StartTag*EndTag*", MID([MemoField]
,Instr(1,[MemoField],"StartTag")+ Len("StartTag")
,Instr(1+Instr(1,[MemoField],"StartTag"),[MemoField],"EndTag")
-Instr(1,[MemoField],"StartTag") - Len("StartTag")),Null)
And that will only handle ONE string. If you had two sets of identical tags,
then the above fails.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County