Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old April 12th, 2007, 05:35 PM
tomlebold@msn.com
Guest
 
Posts: n/a
Default Query to remove middle initial

Look for query that changes Tom L LeBold into Tom LeBold and only when
the middle intial exist.

  #2  
Old April 12th, 2007, 07:25 PM
fredg
Guest
 
Posts: n/a
Default Re: Query to remove middle initial

On 12 Apr 2007 09:29:59 -0700, tomlebold@msn.com wrote:
Quote:
Look for query that changes Tom L LeBold into Tom LeBold and only when
the middle intial exist.
If there is ALWAYS a period after the middle initial, you could use

NoInitial:
IIf(InStr([FieldName],".")>0,Left([FieldName],InStr(FieldName],".")-2)
& Mid([FieldName],InStr([FieldName],".")+2),[FieldName])

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old April 13th, 2007, 11:35 AM
Chuck
Guest
 
Posts: n/a
Default Re: Query to remove middle initial

On 12 Apr 2007 09:29:59 -0700, "tomlebold@msn.com" <tomlebold@msn.comwrote:
Quote:
>Look for query that changes Tom L LeBold into Tom LeBold and only when
>the middle intial exist.
What happens if Tom E LeBold is added later?

Chuck
--
  #4  
Old April 13th, 2007, 04:35 PM
CDMAPoster@FortuneJames.com
Guest
 
Posts: n/a
Default Re: Query to remove middle initial

On Apr 12, 11:29 am, "tomleb...@msn.com" <tomleb...@msn.comwrote:
Quote:
Look for query that changes Tom L LeBold into Tom LeBold and only when
the middle intial exist.
Maybe just grab what's before the first space, if it exists, and
concatenate it with what's after the last space:

IIf(InStr(FieldName, ' ') 0, Left(FieldName, InStr(FieldName, ' ') -
1) & ' ' & Right(FieldName, Len(FieldName) - InStrRev(FieldName, '
')), Null)

Note that the InStrRev function does not exist in Access 97. A
replacement function written by John Viescas and Dirk Goldgar can be
found here:

http://groups.google.com/group/comp....b7cd432f7fb2c3

This expression worked on the few examples I tried along with the
replacement function above. Note that it will not do what you want if
the first or last name contains a space. Maybe the expression above
is adequate for your needs.

Note: The first time I used InStrRev I didn't realize that the index
stayed in the same direction as before. Albert Kallal kindly pointed
out my error in a private email. Without the InStrRev function a user-
defined function such as ReverseString can also be used in Access 97
to get the same results in a slightly less elegant fashion.

James A. Fortune
CDMAPoster@FortuneJames.com

 

Bookmarks

Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles