Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case Sensitive query

Status
Not open for further replies.

crashevans

Programmer
Nov 1, 2006
4
GB
Hi

I want to search a table for a case sensitive result e.g. "Blue", however it currently returns this result whether I search for BLUE, blue etc. I am using Microsoft Access.

The query I tried -
SELECT * FROM User WHERE Password = 'Blue'

Thanks for help in advance.
 
I don't think there's an easy way of doing this.

I've created this function to convert the text into binary equivalent:
Code:
Function TextToBinary(Str As String) As String
Dim L As Integer
For L = 1 To Len(Str)
    TextToBinary = TextToBinary & Asc(Mid(Str, L, 1))
Next L
End Function

Then the query is: [blue]
SELECT * FROM User WHERE (TextToBinary[Password]=66108117101) [/blue]

Where '66108117101' is the concatened binary equivalent of 'Blue'. Obviously if it isn't actually 'Blue' you would need to work out the appropriate code (use the function Asc if you don't know how to do that)

Simon Rouse
 
try
Code:
SELECT * FROM User 
WHERE Strcomp("Blue",[Password],vbBinaryCompare)=0
 
Thanks pwise - I was wrong, forgot about StrComp!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top