PDA

View Full Version : Solved: case sensitive SQL selece query & case sensitive Dlookup



Trevor
03-20-2008, 02:25 PM
How do I perform a cas sensitive:
SQL select query
Dlookup

they are both based on values in a text box that may change
give me examples, I'll try from there.
Thanks for helping.

DarkSprout
03-21-2008, 05:58 AM
Buggerd up another post (this was done by 'Go Advanced')
See Next...

DarkSprout
03-21-2008, 06:02 AM
Use the StrComp Function from within the SQL.

StrComp(Str1, Str2, vbBinaryCompare) = returnValue

If string1 is less than string2 returnValue is -1
if string1 is equal to string2 returnValue is 0
If string1 is greater than string2 returnValue is 1
If either string2Null is Null then returnValue is Null

Trevor
03-21-2008, 01:17 PM
Thanks DarkSprout, that is what I asked but I guess I can't seem to figure it out so here is my Dlookup I want to perform a case sensitive select on;

ststatus = DLookup("[Status]", "PSwrdTbl", "Name = '" & Forms![Form3]![Tech. Name] & "'")

and my sql to do a case sensitive lookup;

Set loRst = CurrentDb.OpenRecordset("SELECT * FROM [PsWrdTbl] WHERE" _
& " [Status]= '" & Me.[status] & "' AND [Name]= '" & Me.[Tech. Name]";"

akn112
03-24-2008, 07:25 AM
ststatus = DLookup("[Status]", "PSwrdTbl", "StrComp([Name],'" & Forms![Form3]![Tech. Name] & "' , vbBinaryCompare) = 0")

something like this? not familiar with strcomp function. Can you verify darksprout?

Trevor
03-24-2008, 12:00 PM
Thanks guys, I solved it late last night, slightly differently, by using the Dlookup and sql, then doing a strcomp [Dlookup variable], Me.[textbox], vbbinaryCompare) = 0
and same concept for SQL