Solved

Extract an alphanumeric  string from a long text field in a MS Access query

Posted on 2016-07-17
2
41 Views
Last Modified: 2016-07-18
Hello

Can someone please help me? I have a long text field which contains an alphanumeric reference which I'm trying to extract in my query and can't seem to get it right.

The string can appear anywhere within the field and begins with "Ref:MSG" and is followed by 8 numbers. These 8 numbers change for each record and there's usually characters or spaces either side of the string.

A couple of string examples are...
action the below request:^Note:  Ref:MSG24621668>^
CUSTOMER^COMMUNICATIONS RE: Ref:MSG61781623non-applicable

The result I am looking for would be...
Ref:MSG24621668
Ref:MSG61781623

If someone could help me with this it would be very much appreciated.

Thanks
darls15
0
Comment
Question by:darls15
2 Comments
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
ID: 41716276
If length of expected result is always 15 symbols, you can use this construction in your query:
Mid([YourField],InStr(1,[YourField],"Ref:MSG"),15)
0
 

Author Closing Comment

by:darls15
ID: 41717959
Awesome, thank you so much!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now