Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mid Function question 1

Status
Not open for further replies.

istone

IS-IT--Management
Jan 24, 2007
139
US
Hi,
I am stuck...
I am trying to get the first initial of the first name and the first letter of the last name (after the space) and combine them with :sh
Here is what I did:

Initials: IIf([Team Leader]="Michael Conaghan","MO:sh",Left([Team Leader],1) & "" & Mid([Team Leader],1,1) & ":" & "sh")

Team Leader Result
John Monna JM:sh

I can't get the M to work..what I am missing. Thanks in advance
 
YOu need to use InStr() to get the location of the space, and add 1 to this to get starting position of last name.

Something like this (typed, untested)

Code:
Initials: IIf([Team Leader]="Michael Conaghan","MO:sh",Left([Team Leader],1) & "" & Mid([Team Leader],InStr([Team Leader], ' ') + 1,1) & ":" & "sh")

Hope it helps,

Alex

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top