MS Access – VBA – Capitalize the First Letter of a String

Below is an example of a function which will capitalize the first letter of a given string.  The second input variable allows you to specify to return the rest of the string as is, or lowercase it.

'---------------------------------------------------------------------------------------
' Procedure : UCase1stLtr
' Author    : Daniel Pineault, CARDA Consultants Inc.
' Website   : http://www.cardaconsultants.com
' Purpose   : Capitalize the first character of a given string
' Copyright : The following may be altered and reused as you wish so long as the
'             copyright notice is left unchanged (including Author, Website and
'             Copyright).  It may not be sold/resold or reposted on other sites (links
'             back to this site are allowed).
'
' Input Variables:
' ~~~~~~~~~~~~~~~~
' sString           String to process
' bLowerCaseTheRest Whether or not the rest of the string should be in lower case or not
'
' Usage:
' ~~~~~~
' UCase1stLtr("hjkwhjkwhkjw12218hjksdjkhNJH", False) -> Hjkwhjkwhkjw12218hjksdjkhNJH
' UCase1stLtr("hjkwhjkwhkjw12218hjksdjkhNJH", True) -> Hjkwhjkwhkjw12218hjksdjkhnjh
' UCase1stLtr("hjkwhjkwhkjw12218hjksdjkhNJH") -> Hjkwhjkwhkjw12218hjksdjkhnjh
'
' Revision History:
' Rev       Date(yyyy/mm/dd)        Description
' **************************************************************************************
' 1         2012-Mar-02                 Initial Release
'---------------------------------------------------------------------------------------
Function UCase1stLtr(sString As String, Optional bLowerCaseTheRest As Boolean = True) As String
On Error GoTo Error_Handler

    Select Case Len(sString)
        Case 0
            UCase1stLtr = vbNullString
        Case 1
            UCase1stLtr = UCase(sString)
        Case Else
            UCase1stLtr = UCase(Left(sString, 1)) & IIf(bLowerCaseTheRest, LCase(Mid(sString, 2)), Mid(sString, 2))
    End Select

Error_Handler_Exit:
    On Error Resume Next
    Exit Function

Error_Handler:
    MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf & sModName & "/UCase1stLtr", True
    Resume Error_Handler_Exit
End Function