Do you want of the get rid of the accented characters when you convert a string to upper case in VBA ?
Sure, if you’re developing an Access (or another Office – Excel, Word, etc… – or VB/A) application targeting french, you’ll want to sometimes avoid the À for Ucase$(“à”).
I’m speaking of the default behavior of VB/A’s Ucase$() function:
This UUCase() function may spare you some time (talking about minutes, of course):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
Function UUCase(ByVal psSource As String) As String Dim i As Long Dim iLen As Long Dim sRet As String Dim sChar As String iLen = Len(psSource) If iLen > 0 Then For i = 1& To iLen sChar = Mid$(psSource, i, 1) Select Case sChar Case "à", "á", "ä", "â" sChar = "A" Case "é", "è", "ë", "ê" sChar = "E" Case "í", "ì", "ï", "î" sChar = "I" Case "ó", "ò", "ö", "ô" sChar = "O" Case "ú", "ù", "ü", "û" sChar = "U" Case "ç" sChar = "C" Case Else sChar = UCase$(sChar) End Select sRet = sRet & sChar Next i UUCase = sRet End If End Function |
Voilà.