Link to home
Start Free TrialLog in
Avatar of exp vg
exp vg

asked on

Access - Keep last most component in Last Name field

I have a field Last Name, that may or may not contain more than one entities, separated by a space. I am hoping to retrieve the last most component before the first space going from right to left.

Example:

De La Cruz
Cruz
Guzman Cruz

In all instances, I am hoping to receive

Cruz

I have tried
Right([Last Name],Len([Last Name])-InStr([Last Name],",")-1)
and
IIf([Last Name] Like "* *",Left([Last Name],InStr([First Name]," ")-1),[Last Name])
and
IIf([Last Name] Like "* *",Left([Last Name],InStr([First Name]," ")+1),[Last Name])

Please advise.
Avatar of aikimark
aikimark
Flag of United States of America image

Use InstrRev() to do your searching from the end of the string.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of exp vg
exp vg

ASKER

Thanks so much.