Seeking help to extract letters from name fields

MonarTech

Registered User Developer
Local time
Tomorrow, 07:44
Joined
May 5, 2005
Messages
12
Hi all: I have two fields family_name & given_name.I need to extract 2nd, 3rd & 5th letters of family_name and 2nd & 3rd letters of given_name into text field called link_key. Where names do not have suffient letters for extraction then the numeral 2 is used as a replacement. Currently entering link_key data manually but is there another way?
 
You might try something like:
Code:
UPDATE [MyTableName]
SET link_key=UCase(
    Iif(Mid(family_name,2,1)>'',Mid(family_name,2,1),'2') &
    Iif(Mid(family_name,3,1)>'',Mid(family_name,3,1),'2') &
    Iif(Mid(family_name,5,1)>'',Mid(family_name,5,1),'2') &
    Iif(Mid(given_name,2,1)>'',Mid(given_name,2,1),'2') &
    Iif(Mid(given_name,3,1)>'',Mid(given_name,3,1),'2')
);
See if ths works for you.
 
Thanks for the code

Thanks Byte Myzer where do I attach the code Query? Table? Form? property
 
This is not a "code" query. I enclosed the SQL statement in a code box because it keeps the formatting (including indentations) intact. Simply copy the text in the code box into the SQL workspace of a new query, save the query, and run it.
 

Users who are viewing this thread

Back
Top Bottom