Extracting string from parenthesis- how??

V

Victoria

I need to pull text from a parenthesis where there is text on both sides of
the desired info. For example
11294GGsewrf PPO asfdio(dfjios)sd/12

I'm using the function below, but it is not taking off the right side of the
data. What can I do to remove that as well? I'd like to continue to do this
as a function within a query.
Thanks.
-Victoria

Plan_Code:
Mid([tbl1]![Plan],InStr(1,[tbl1]![Plan],"(",1)+1,Len([tbl1]![Plan])-(InStr(1,[tbl1]![Plan],"(",1)+1))
 
J

Jeff Boyce

Victoria

You don't say whether the text between parentheses is always the same length
or not, so I'll assume it is not.

Just like you used the InStr([x],"(") to find the open-paren, you could use
InStr([x],")") to find the close-paren.

Knowing the location of both ends would let you use Mid([x],{location of
"("}, {location of ")"), or something like that.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top