From: Michaelcip on
Thanks in advance...
I'm trying to parse the following field (Machine) to eliminate the "-SAP"
How is this done? Many thanks, MC

Machine
DT-1-SAP
EC-1600-SAP
EC-1600-SAP
EC-1600-SAP
EC-1600-SAP
EC-1600-SAP
EC-1600YZT-SAP
EC-2000-SAP
From: John W. Vinson on
On Sat, 13 Mar 2010 11:57:01 -0800, Michaelcip
<Michaelcip(a)discussions.microsoft.com> wrote:

>Thanks in advance...
>I'm trying to parse the following field (Machine) to eliminate the "-SAP"
>How is this done? Many thanks, MC
>
>Machine
>DT-1-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600YZT-SAP
>EC-2000-SAP

What's the context, MC? Are you trying to permanently remove the -SAP suffix
from all records? display the field without the suffix? search the field
ignoring the suffix?

More info please!
--

John W. Vinson [MVP]
From: Marshall Barton on
Michaelcip wrote:
>I'm trying to parse the following field (Machine) to eliminate the "-SAP"
>How is this done? Many thanks, MC
>
>Machine
>DT-1-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600-SAP
>EC-1600YZT-SAP
>EC-2000-SAP


If the -SAP is guaranteed to always be there:

Left(Machine, Len(Machine) - 4)

But if it might not be there in some records and the field
might be Null sometimes, it can get messy:

IIf(Machine Is Null, Null, IIf(Machine Like "*-SAP",
Left(Machine, Len(Machine) - 4), Machine)

--
Marsh
MVP [MS Access]
From: DrGUI on
Try:

replace(machine,"-sap","")



"Michaelcip" wrote:

> Thanks in advance...
> I'm trying to parse the following field (Machine) to eliminate the "-SAP"
> How is this done? Many thanks, MC
>
> Machine
> DT-1-SAP
> EC-1600-SAP
> EC-1600-SAP
> EC-1600-SAP
> EC-1600-SAP
> EC-1600-SAP
> EC-1600YZT-SAP
> EC-2000-SAP
From: David W. Fenton on
=?Utf-8?B?RHJHVUk=?= <DrGUI(a)discussions.microsoft.com> wrote in
news:25331FDB-4971-48E6-A83E-A53DA4C92C66(a)microsoft.com:

> Try:
>
> replace(machine,"-sap","")

If you assume that the string "-sap" can occur only at the end and
not internally, that would work. Otherwise, not so much!

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/