Extract part of a text field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with a column named "Remarks". All of the data looks like this:
EQ: 4803CAGEN001, OPERATION: HYDRAULIC, LOC: ENGINE ROOM\\\\ LOWER
LEVEL\\\\ PORT\\\\ FORWARD\\\\ CRIT CODE: 0, TECH MANUAL INDEX: 178,

I only want to see the LOC:.....and stop at CRIT.

How do I export this information?
 
It is easiest to do this with a custom function. But it can also be done
with a standard Query. You will need to use the following built in text
functions:

Mid («stringexpr», «start», «length»)
and
InStr («start», «stringexpr1», «stringexpr2», «compare»)

(the compare parameter is optional and I did not use it below.)

Cut & paste this into a Query
ExportStr:
Mid([Remarks],InStr(1,[Remarks],"LOC"),InStr(1,[Remarks],"CRIT")-InStr(1,[Remarks],"LOC"))

be careful of syntax, a extra , or ) will mess everything up.

Good luck
 
Thank you very much! That did it. Now I just need to study how you did it,
so I'll know the next time.

Semi said:
It is easiest to do this with a custom function. But it can also be done
with a standard Query. You will need to use the following built in text
functions:

Mid («stringexpr», «start», «length»)
and
InStr («start», «stringexpr1», «stringexpr2», «compare»)

(the compare parameter is optional and I did not use it below.)

Cut & paste this into a Query
ExportStr:
Mid([Remarks],InStr(1,[Remarks],"LOC"),InStr(1,[Remarks],"CRIT")-InStr(1,[Remarks],"LOC"))

be careful of syntax, a extra , or ) will mess everything up.

Good luck

2Blessed4Stress said:
I have a table with a column named "Remarks". All of the data looks like this:
EQ: 4803CAGEN001, OPERATION: HYDRAULIC, LOC: ENGINE ROOM\\\\ LOWER
LEVEL\\\\ PORT\\\\ FORWARD\\\\ CRIT CODE: 0, TECH MANUAL INDEX: 178,

I only want to see the LOC:.....and stop at CRIT.

How do I export this information?
 

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

Back
Top