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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling text out of a field

Status
Not open for further replies.

lauriesamh

Technical User
Sep 1, 2004
119
US
Hi,
I have in table two fields First Name (FNAME) and Middle Initial (MI). In some case the MI is populated. When it is not then the true middle initial is occasionally typed in FNAME with a space " " then the Middle initial example:"Jane M". I want to pull the "M" and place it into a new field (MI corrected). This is what I'm using below. My problem is that when the (MI) is not populated and the FNAME has no middle initial the new (MI Corrected) field populates what is in the FNAME. Any assistance would be appreciated.

MI Corrected: IIf([Member Middle Name] Is Null,Right([Member First Name],Len([Member First Name])-InStrRev([Member First Name]," ",-1)),[Member Middle Name])
 
one way:
Code:
MI Corrected: IIf(([Member Middle Name] Is Null)[COLOR=blue] and (InStr([Member First Name]," ")>1)[/color],Right([Member First Name],Len([Member First Name])-InStrRev([Member First Name]," ",-1)),[Member Middle Name])

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Followup question.. how would I parse the first name only? IE take the Middle Intial out of the First Name and put that result into a FN Corrected field
 
Apply very similar principles, something like:
Code:
FN Corrected : IIf(InStr([fname]," ")>0,Left([fname],InStr([fname]," ")-1),[fname])
Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Glad to help [smile]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top