Re: Copy only part of text string
- From: "Michel Walsh" <vanderghast@VirusAreFunnierThanSpam>
- Date: Wed, 2 May 2007 13:49:50 -0400
InStr() could be used to spot the word Error:
? InStr("Hello, World, is that an error we just saw?"", "Error" )
26
So, you can then retrieve from that position (+5, if you don't want the word
error itself):
Mid( myString & "Error", 5+ InStr(myString & "Error", "Error") )
Note that I appended the searched string to the initial string, so it is
always 'found'. Indeed, if the string is not found, InStr returns 0 and Mid
would produce an error, in that case.
Hoping it may help,
Vanderghast, Access MVP
"hobbit2612 via AccessMonster.com" <u27332@uwe> wrote in message
news:7195904679508@xxxxxx
Hi,
Wonder if someone maybe able to help me please.
I have a database at work that contains details of test files. One of the
fields for each test shows that actual error that caused the file to fail.
The problem is, is that there is an awful lot of text from this field that
I
don't need to extract.
The text I need to extract starts with the word Error and then the rest of
the text that comes after it in the text string. The word Error can appear
anywhere within the text string, but having worked through all of the
failures I beleive that 'Error' can be used as the guide to start
extracting
from.
I'm fairly new to Access, and I did try using the 'Mid' and 'Last'
functionaity, but this didn't seem to work.
Could someone perhaps point me in the direction please of how I could put
a
function/coding into a query that will extract the information and where
if
the word 'Error' doesn't appear within the text string it just leaves the
field blank in the query.
Many thanks an regards
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200705/1
.
- Follow-Ups:
- Re: Copy only part of text string
- From: hobbit2612 via AccessMonster.com
- Re: Copy only part of text string
- References:
- Copy only part of text string
- From: hobbit2612 via AccessMonster.com
- Copy only part of text string
- Prev by Date: Insert Into works... how about Remove From?
- Next by Date: Re: Insert Into works... how about Remove From?
- Previous by thread: Copy only part of text string
- Next by thread: Re: Copy only part of text string
- Index(es):
Relevant Pages
|