G Guest Mar 16, 2004 #1 Hi all, does anyone happen to know how we can extract the first letter of each word in a field to form a new abbreviation in Access? Thanks!
Hi all, does anyone happen to know how we can extract the first letter of each word in a field to form a new abbreviation in Access? Thanks!
K Kevin3NF Mar 16, 2004 #2 Select Left(FieldName,1) from MyTable -- Kevin Hill President 3NF Consulting www.3nf-inc.com/NewsGroups.htm Ming said: Hi all, does anyone happen to know how we can extract the first letter of Click to expand... each word in a field to form a new abbreviation in Access? Thanks!
Select Left(FieldName,1) from MyTable -- Kevin Hill President 3NF Consulting www.3nf-inc.com/NewsGroups.htm Ming said: Hi all, does anyone happen to know how we can extract the first letter of Click to expand... each word in a field to form a new abbreviation in Access? Thanks!
G Graham R Seach Mar 17, 2004 #3 Ming, Public Function GetAbbrevs(sText As String) As String Dim sTmp As String sText = Trim(sText) Do While InStr(1, sText, " ") > 0 sTmp = sTmp & Left(sText, 1) sText = Mid(sText, InStr(1, sText, " ") + 1) Loop GetAbbrevs = sTmp & Left(sText, 1) End Function If you need to call this from a query, use the following syntax: SELECT field1, field2, GetAbbrevs(field3) As somename FROM tblMyTable Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Ming said: Hi all, does anyone happen to know how we can extract the first letter of Click to expand... each word in a field to form a new abbreviation in Access? Thanks!
Ming, Public Function GetAbbrevs(sText As String) As String Dim sTmp As String sText = Trim(sText) Do While InStr(1, sText, " ") > 0 sTmp = sTmp & Left(sText, 1) sText = Mid(sText, InStr(1, sText, " ") + 1) Loop GetAbbrevs = sTmp & Left(sText, 1) End Function If you need to call this from a query, use the following syntax: SELECT field1, field2, GetAbbrevs(field3) As somename FROM tblMyTable Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Ming said: Hi all, does anyone happen to know how we can extract the first letter of Click to expand... each word in a field to form a new abbreviation in Access? Thanks!