How to pull last name only from two difference login

Hi Experts,
I have a question about how to pull only last name under two difference login.
a). Login as John.Doe
     how do I only pull Doe

b). JDoe
     how do I only pull Doe

Thanks,
urjudoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
if the format of the two login name are consistent i.e.,
a. separated by a dot
b. first and second letter are uppercase

confirm if this is correct.



this can be done using VBA codes
0
Paul Cook-GilesSenior Application DeveloperCommented:
This function will return the characters after any specified character(s):

<><>
Function LastBit(strNa As String, optional strDelimiter As String)
'this function returns the characters to the right of the first sought character
'if no delimiter is passed in, a space will be used as the delimiter

If strDelimiter = "" Then strDelimiter = " "
'SEEKING FROM THE RIGHT END OF THE STRING

   LastBit = Right(strNa, Len([strNa]) - InStrRev([strNa], strDelimiter))
End Function
<><>

so pasting     ?LastBit("John.Doe", ".")         in the immediate window will return
Doe


If you want to return only the first character of a string, use

<><>
Public Function FirstChar(strText As String) As String
   FirstChar = Left(strText, 1)
End Function
<><>

pasting   ?FirstChar("JDoe")  into the immediate window will return
J
0
urjudoAuthor Commented:
answer for Rey Obrero.  
a). yes, first name and Last name is separated by a dot
b). sorry, they are lowercase.  (jdoe)
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Rey Obrero (Capricorn1)Commented:
a. mid("John.Doe", Instr("John.Doe",".")+1)

b.  mid("jdoe",2)
0
urjudoAuthor Commented:
sorry, Rey Obrero.  I forgot to let you know that is a field name username.
0
Rey Obrero (Capricorn1)Commented:
if instr(login,".") then
   Lname=mid(login, Instr(login,".")+1)
else
  LName=mid(login,2)
end if
0
Paul Cook-GilesSenior Application DeveloperCommented:
Ooop-- misread your second question.  Sorry!  Rey is correct.
0
Rey Obrero (Capricorn1)Commented:
if instr([username],".") then
   Lname=mid([username], Instr([username],".")+1)
else
  LName=mid([username],2)
end if
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
urjudoAuthor Commented:
is anyway I can put into a query?
0
urjudoAuthor Commented:
got it
0
urjudoAuthor Commented:
Thank you!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.