From :
Stephen Rasey, 18-Aug-2004, microsoft.public.access.modulesdaovba
Thread: MD5 HASH with single quote = grief in dao.FindFirstHere is a solution
to the problem described in the thread. Namely a dao recordset using
a .FindFirst sql
where the sql searched for a text string with a single quote.
Doubling the single quote failed to make a match.
Further investigation showed that the .FindFirst was case insensitive.
You must use a full SQL query string using the Where clause (0=StrComp([field],"searchstring",0))
You cannot use that clause in a .FindFirst Filter.
news:ujepdLbhEHA.1392@TK2MSFTNGP11.phx.gbl...
Function H70CheckBin(strHash As String) As Long
'A Case Sensitive SQL match for the HASH.
'return the IDHashProspSched if the strHash is found in
H70HashProspSched
'return 0 if not found. Protect against 0 being a legitimate ID.
'technique from http://support.microsoft.com/?kbid=209674
Dim sql As String
Dim rsh70 As DAO.Recordset
Set rsh70 = dbTS.OpenRecordset("Select * from H70HashProspSched as H
WHERE (0 = StrComp(H.HASH, '" & wwQuoteFix(strHash) & "',0))")
With rsh70
If .EOF Then
H70CheckBin = 0
Else
H70CheckBin = !IDHashProspSched
End If
End With
Set rsh70 = Nothing
End Function
ID = H70CheckBin("aAaAaAaBcDeFG") 'Answer is -2030670587 correct
ID = H70CheckBin("aAaAaAABcDeFG") 'Answer is 0 correct!
ID = H70CheckBin("AAAAAABCDEFG") 'answer is 1092326831 correct
ID = H70CheckBin("AAaAAABCDEFG") 'answer is 0
correct.
ID = H70CheckBin("$¥¨3¶¯ô¼.Ë©£F³Ñ") 'Answer is -1915054114 works
ID = H70CheckBin("-s3ë='[+@û;ÒëN") 'Answer is 1106461086 works.
It even works on the single quote.
I still say there is a problem with a single quote in a
dao.recordset.findfirst. But the solution to fix the case insensitivity
also fixes the single quote problem.