If you have to change the sort order of data returned in a RecordSet to behave case sensitive in VBA you can use a trick, which is provided by Microsoft.

Source Code

The below function returns a hexadecimal representation of a handed String, which can then be used in an ORDER BY clause of a sequel statement.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
' @Author - Microsoft
' @ChangeDate - 2007
' @Description - Returns the hexadecimal expression for a handed String,
' which can then be used in sequel statements to sort case sensitive.
' @Remarks - Original Source can be gotten from the following URL.
' https://support.office.com/en-us/article/Sort-records-in-case-sensitive-order-8fea1de4-6189-40e7-9359-00cd7d7845c0
Function StrToHex(S As Variant) As Variant
    Dim Temp As String
    Dim I As Integer
    
    If VarType(S) <> 8 Then
        StrToHex = S
    Else
        Temp = ""
        For I = 1 To Len(S)
            Temp = Temp & Format(Hex(Asc(Mid(S, I, 1))), "00")
        Next I
        StrToHex = Temp
    End If
End Function

Example

1
2
3
select * 
from aTable 
order by StrToHex(aTextField)

References

Original Source is available at following URL.
https://support.office.com/en-us/article/Sort-records-in-case-sensitive-order-8fea1de4-6189-40e7-9359-00cd7d7845c0