Filer out extra characters from a Fied

A

Addy

Hello there,

I have a partial solution to a problem I am having.

I have a field called description. In that field I want to check if it
includes some characters and remove them. If it does not then all is
fine.

Description
------------------
Apple II TXT>>
Apple II >>
Apple II
Apple II TXT
Orange TXT>>
Orange >>
Orange
Orange >>>>>>

Basically I want to remove the ">>" and "TXT" from the fields and have
the following output.


Description2
------------------
Apple II
Apple II
Apple II
Apple II
Orange
Orange
Orange
Orange

I have tried New:
Left([FunctLocDescrip],InStr([FunctLocDescrip],">")-1) in the query
builder.
But it gives an error everytime the field DOES NOT include the extra
characters.

Any one with suggestions???
 
J

Jerry Whittle

Use the Replace function. As you are looking for more than one thing to
replace, you'll need to nest them.

Debug. Print Trim(Replace(Replace("Apple II TXT>>",">",""),"TXT",""))

returns "Apple II" . The Trim takes care of leading and trailing spaces. In
a query it would look something like:

Description2: Trim(Replace(Replace([Description],">",""),"TXT",""))
 
J

Jerry Whittle

Use the Replace function. As you are looking for more than one thing to
replace, you'll need to nest them.

Debug. Print Trim(Replace(Replace("Apple II TXT>>",">",""),"TXT",""))

returns "Apple II" . The Trim takes care of leading and trailing spaces. In
a query it would look something like:

Description2: Trim(Replace(Replace([Description],">",""),"TXT",""))
 
A

Addy

Thanks alot. This worked. What if I want to include more than 2
criterias?


Jerry said:
Use the Replace function. As you are looking for more than one thing to
replace, you'll need to nest them.

Debug. Print Trim(Replace(Replace("Apple II TXT>>",">",""),"TXT",""))

returns "Apple II" . The Trim takes care of leading and trailing spaces. In
a query it would look something like:

Description2: Trim(Replace(Replace([Description],">",""),"TXT",""))
--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Addy said:
Hello there,

I have a partial solution to a problem I am having.

I have a field called description. In that field I want to check if it
includes some characters and remove them. If it does not then all is
fine.

Description
------------------
Apple II TXT>>
Apple II >>
Apple II
Apple II TXT
Orange TXT>>
Orange >>
Orange
Orange >>>>>>

Basically I want to remove the ">>" and "TXT" from the fields and have
the following output.


Description2
------------------
Apple II
Apple II
Apple II
Apple II
Orange
Orange
Orange
Orange

I have tried New:
Left([FunctLocDescrip],InStr([FunctLocDescrip],">")-1) in the query
builder.
But it gives an error everytime the field DOES NOT include the extra
characters.

Any one with suggestions???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top