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
each word in a field to form a new abbreviation in Access? Thanks!