473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Query to remove middle initial

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

Apr 12 '07 #1
3 5558
On 12 Apr 2007 09:29:59 -0700, to*******@msn.com wrote:
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
Apr 12 '07 #2
On 12 Apr 2007 09:29:59 -0700, "to*******@msn.com" <to*******@msn.comwrote:
>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
--
Apr 13 '07 #3
On Apr 12, 11:29 am, "tomleb...@msn.com" <tomleb...@msn.comwrote:
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
CD********@FortuneJames.com

Apr 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Christopher | last post by:
This should be a quick one. URL: http://cfa-www.harvard.edu/~cpilman/Stuff/flush.html Code: ============================= <!DOCTYPE HTML Public "-//W3C//DTD HTML 4.01//EN">...
5
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the...
2
by: P B via AccessMonster.com | last post by:
I have a list of 160,000 records with these fields: fname, lname, address, city, state, zip, dob I need to generate a list with all fields where the first initial of lname and the dob are...
2
by: Daniel | last post by:
Is is possible to remove elements from the middle of a System.Collections.Queue? For the most part i just use endqueue and dequeue but there are points where i know that i no longer need certain...
1
by: hardik | last post by:
hi friends i need help in this sql query i have table like, id fid __ _____ autonumber text and i am storing values like
2
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
How can I run this query against a table in my Access database? I don't know hwo to use it in C#. In VB I would use .Recordset = "some sql statement". How do I do this in C#? //I get a vlaue...
5
by: ernestb08 | last post by:
I have a Customers Table with the following field names. C_FirstName C_LastName C_MiddleI .. .. .. .. ..
1
by: joeino | last post by:
I want to do a lookup query and append the record to a history table before editing the data. I created a macro to run the lookup query to append the record to history and it works fine. I did the...
11
by: Hamayun Khan | last post by:
HI All My client requirements are such that I m going to generate query runtime in asp.net. At some time the query reaches to very much length as below SELECT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.