update query

lestats

Registered User.
Local time
Today, 11:14
Joined
Apr 12, 2012
Messages
15
Hello,

I have a field with given names such as :

Mrs Gordon
Mrs Doyer
King
Larry

I would like to remove only the Mrs title in the field in order to have only the given names without the title Mrs :

Gordon
Doyer
King
Larry

So far I tried a update query :

UPDATE [Copy Of matched uptake_OASP1208] SET [Copy Of matched uptake_OASP1208].GIVEN_NAME = Left([Copy Of matched uptake_OASP1208]![GIVEN_NAME],3)=" "
WHERE ((Left([Copy Of matched uptake_OASP1208]![GIVEN_NAME],3)="mrs "));

It doesn't work. It returned 0. It seems my rational is not good in my SQL.

Any helps would be welcome.
 
Use the Replace function in your update criteria:

Update tablea
set PersonName = Replace([PersonName],"Mrs","")
 
You might also want to use Ltrim to trim any spaces: Ltrim(Replace([PersonName],"Mrs",""))
 
Thx AccessMssql. It works perfectly. I used :

SET [Copy Of matched uptake_OASP1208].GIVEN_NAME = Replace([Copy Of matched uptake_OASP1208]![GIVEN_NAME],"mrs"," ")
WHERE (((Left([Copy Of matched uptake_OASP1208]![GIVEN_NAME],3))="mrs"));. I will try the Ltrim function to remove spaces.
 

Users who are viewing this thread

Back
Top Bottom