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-00cd7d7845c0FunctionStrToHex(SAsVariant)AsVariantDimTempAsStringDimIAsIntegerIfVarType(S)<>8ThenStrToHex=SElseTemp=""ForI=1ToLen(S)Temp=Temp&Format(Hex(Asc(Mid(S,I,1))),"00")NextIStrToHex=TempEndIfEndFunction