473,763 Members | 7,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5580
On 12 Apr 2007 09:29:59 -0700, to*******@msn.c om 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(FieldNam e],".")-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(Field Name, ' ') 0, Left(FieldName, InStr(FieldName , ' ') -
1) & ' ' & Right(FieldName , Len(FieldName) - InStrRev(FieldN ame, '
')), 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********@Fort uneJames.com

Apr 13 '07 #4

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

Similar topics

4
2657
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"> <HTML><Head><Title>Get my feet off the ground</Title> <Meta HTTP-Equiv="Content-Type" Content="text/html; charset=us-ascii"> <Style type="text/css"> Body { font-size: 60px; }
5
3320
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 main form is reactivated following opening and closing a modal form. Strangely, this was not a problem until I started using my Access 2000 db in Access 2003 (as an Access 2000 db). Details follow... I have an unbound combo box on my main form...
2
3009
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 equal. How? I can't seem to get Left() to work in a query. Could I put this in a VBscript and generate a recordset? What's the easiest way to generate this list? This seems so simple.
2
2181
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 elements that could be in the middle of the queue that i would like to clean out of the queue. however, my queue size is gigabytes large and i cant afford the time to reallocate the entire queue just to remove a middle element. do i need to write...
1
1576
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
17653
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 form a cell and apply it to the SQL statement commandCol = scriptDataGridView.FormattedValue.ToString(); string sCommand = "SELECT CommandString FROM Commands WHERE CommandName = " + commandCol; //This reutne a valie SQL statement which will return...
5
2280
by: ernestb08 | last post by:
I have a Customers Table with the following field names. C_FirstName C_LastName C_MiddleI .. .. .. .. ..
1
2288
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 same with the lookup query that allows the user to edit the record. I then converted them to vb and combined them. Code follows. My thinking is to create a variable dim keyno longint then pass keyno to the lookup queries. I am kind of new...
11
1655
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 tblJobPost.JobTitle,tblJobPost.JobDesc,Scraped,tblSchools.logoimage,tblJobPost.JobPostID,tblJobPost.SchoolID,tblSchools.web,cast(tblJobPost.MemType as nvarchar(255)) as MemType,tblSchools.InstitutionName,tblSchools.InstitutionName as Empname,tblJobPost.PayScale,cast(tblLEA.LEA...
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10144
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7366
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.