Striping a common word from a field

J

JohnB

Hi.

Im working on an A2000/XP mdb which has a field containing entries like
"Maths Mentor", "English Mentor", "Music Mentor" etc. The second word is
always Mentor. Is there an expression I can use in a query that strips off
the "Mentor" part and allows me to produce a field in a report containing
just "Maths", "Music" etc? I'm not too worried about removing the space
between the words.

Thanks, JohnB
 
G

Graham R Seach

See the online Help for the Replace() function.

Replace("Math Mentor", " Mentor", "")
....or...
Trim(Replace("Math Mentor", "Mentor", ""))
....will both return "Math"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
J

JohnB

Hi Graham.
Thanks Graham.

I was confused a little at first until I realised that you meant:

Replace([Function], " Mentor", "")

where Function is the name of the field in question. Works perfectly when I
use that.

Thanks for the quick response, JohnB
 
Top