Select part of a String

Sezzy

Registered User.
Local time
Today, 19:03
Joined
Nov 3, 2004
Messages
19
Is there a way I can select the last part of a string after a space?

e.g. I want to get all the last words from the first line of address. So if it was 1 Smith Close, I just want the word 'Close'.

I've tried using the RIGHT function, but as all the words are different lengths, that isn't very helpfull.

Thank you
 
Code:
Right([YourField],InStrRev([YourField]," ")-1)
 
This is an example of what that code produced:

reen Lane
gs Lane
wer Close
ew Pool Road
en Court
ees Road
l Street
verwood Close
eneagles Road
estfield Road
rescent
eneagles Road

It seems to be finding everything after the first space and then cutting off the first 2 characters.

Any way it could find everything after the last space????

Thanks
 
Code:
Mid$([YourField], InStrRev([YourField], " ") + 1)
 
I now need the code to find the first word in a string. I have tried using the InStrRev function but I think that looks for everything after/before the last space. At the moment I'm using:

Left$([Ad1],InStrRev([Ad1]," ")-1)

But that gives me this:

6a Green
3 Ings
13 Lower
52 New Pool
4b Amen
31 Rees

And I just want the numbers, which is the first word.

Thanks for any help
 
Code:
Left([Field], InStr(1, [Field], " "))
 

Users who are viewing this thread

Back
Top Bottom