Removing a certain word from a field

G

Guest

Hi.

I have a SchoolName field pulled out in a query, which contains names like:

High St School
Manor Primary School
Finchley First Boys School
Marlborough Secondary

I want to to create another field in the query, called say SchoolNameShort,
which shows the School name minus the word 'School' and the space just in
front of it, for those Schools that have it. It would then show a truncated
name, e.g.

High St
Manor Primary
Finchley First Boys
Marlborough Secondary

Can this be done?

Thanks, JohnB
 
J

John Spencer

Sure, just used a calculated field. If " School" is always at the end,

Field: SchoolShortName: IIF(Right(SchoolName,7)="
School",Left(SchoolName,Len(SchoolName)-7),SchoolName)

Look up Right, Left, Len in VBA help to understand what this is doing.
 
G

Guest

Thanks John.

I'll have to wait til tomorrow to try that out. I'll get back to you then.

Cheers, JohnB
 
G

Guest

Hi again John.

As expected, this works perfectly.

Thanks for the quick and accurate help.

JohnB
 

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