Solved

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

Posted on 2016-07-17
2
47 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

803 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