Re: Returning Partial Strings
- From: John W. Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 16:59:55 -0700
On Thu, 31 Jan 2008 14:44:02 -0800, ScottM <ScottM@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
I'm trying to separate a word/string of characters in a text field from the
rest of the field, but the strings are of varying lengths. Is there a way to
extract this? For example, my field contains the following values:
RAST 2006-1 M5
CWALT 2006-AR1 A
How can I extract the "RAST" and the "CWALT" from each?
How can I extract the "2006-1" and the "2006-AR1" from each?
Thanks in advance!
You can use the builtin string handling functions Left(), Mid(), and InStr().
To get the leftmost bit (before the first space) use
Left([fieldname], InStr([fieldname], " ") - 1)
The second bit is a bit more complex since you need to find both delimiting
blanks:
Mid([fieldname], InStr([fieldname], " ") + 1, Instr(Instr([fieldname], " ") +
1, [fieldname], " ") - InStr([fieldname], " ") - 1)
John W. Vinson [MVP]
.
- Prev by Date: Re: non updateable query
- Next by Date: Re: cross tab confusion
- Previous by thread: Re: Returning Partial Strings
- Next by thread: Re: If Then. Maybe?
- Index(es):
Relevant Pages
|