A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

First Letter of each word



 
 
Thread Tools Display Modes
  #1  
Old June 7th, 2010, 06:48 PM posted to microsoft.public.access.reports
PJ
external usenet poster
 
Posts: 265
Default First Letter of each word

I have the following in a text box field:

=IIf([Comp Entered By] Is Null,"",Left([Comp Entered By],1) & Mid([Comp
Entered By],InStr(1,[Comp Entered By],",")+2,1))

the field "Comp Entered By" is based off of a lookup table of names.

I want the above code to only give me the initials of any given name like:

Christian Many would be CM and the above code is giving me Ch.

What should I change on the above code?

Thanks in advance

Ads
  #2  
Old June 7th, 2010, 08:10 PM posted to microsoft.public.access.reports
John Spencer[_2_]
external usenet poster
 
Posts: 4
Default First Letter of each word

Assuming a max of two words, and exactly one space between first and last word.

Left([Comp Entered By],1) &
MID([Comp Entered By],Instr(1,[Comp Entered By]," ")+1,1)

IF you have more than two words (names) in the field then you have to decide
what you want to do. Oscar de la Renta, Mary Jo Kopechne, Mary Anne Smythe

PJ wrote:
I have the following in a text box field:

=IIf([Comp Entered By] Is Null,"",Left([Comp Entered By],1) & Mid([Comp
Entered By],InStr(1,[Comp Entered By],",")+2,1))

the field "Comp Entered By" is based off of a lookup table of names.

I want the above code to only give me the initials of any given name like:

Christian Many would be CM and the above code is giving me Ch.

What should I change on the above code?

Thanks in advance

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.