Solved

case sensitive select statement in Access 2000?

Posted on 2002-07-17
18
305 Views
Last Modified: 2012-05-04
how can I force the Select statement to be case sensitive? I am working in CFM and I need Select * from table where X like 'Y' to be different from
Select * from table where X like 'y'

HELP!!
0
Comment
Question by:labambina
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
  • +3
18 Comments
 
LVL 8

Expert Comment

by:dds110
ID: 7159549
Have you tried using

"Select * from table where x like '" & [ucase, lcase]('y') & "';"

Just a thought.
0
 
LVL 28

Expert Comment

by:TextReport
ID: 7159566
You can use the StrComp("Y", "y", 0) = 0 for binary comparison

Cheers, Andrew
0
 

Author Comment

by:labambina
ID: 7159637
I am also working in Access
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:labambina
ID: 7159639
I am using access 2000
0
 
LVL 28

Expert Comment

by:TextReport
ID: 7159679
Straight from an access 2000 query,

SELECT USystblSecurityGroups.strGroupName, StrComp([strgroupname],"grpMKCITLibrary",0) AS Expr1
FROM USystblSecurityGroups
WITH OWNERACCESS OPTION;

Cheers, Andrew
0
 

Author Comment

by:labambina
ID: 7159748
thx andrew
I will check it and get back 2 u asap
0
 
LVL 2

Expert Comment

by:kiddiec
ID: 7160477
If using a form to make the comparison, look at the module behind the form in the general section it will probably have a line
'Option Compare Database'
Change this to read 'Option Compare Binary' then a will not = A
0
 
LVL 2

Expert Comment

by:kiddiec
ID: 7160520
Further to my previous answer, if working in a query you could use the following built in function to make your comparison

iif(asc(Field1)=asc(field2),"Match","Nomatch")
0
 
LVL 2

Expert Comment

by:kiddiec
ID: 7160523
If using a form to make the comparison, look at the module behind the form in the general section it will probably have a line
'Option Compare Database'
Change this to read 'Option Compare Binary' then a will not = A

0
 

Author Comment

by:labambina
ID: 7168979
none of the suggested answered worked so far....
still looking
0
 
LVL 28

Expert Comment

by:TextReport
ID: 7170094
What is CFM? If you are using an ODBC driver to select the data then you will have to code it in CFM as JET doesn't support Case sensitive queries. Check out the MS KB article Q209674 this advises the use of ASC() or STRCOMP both of which are VBA functions.

Cheers, Andrew
0
 

Author Comment

by:labambina
ID: 7176950
cold fusion.. u know like asp :)
0
 

Author Comment

by:labambina
ID: 7176957
I use ODBC to connect
0
 
LVL 28

Expert Comment

by:TextReport
ID: 7177743
The only thing you can do is to select the data through the ODBC driver which is not case sensitiy then process the results so you can eliminate the case sensitive stuff.

Cheers, Andrew
0
 
LVL 3

Accepted Solution

by:
YP earned 50 total points
ID: 7200518
Ciao labambina,

you can use the StrComp function for this.

From Access 97 Help
<
StrComp Function

Returns a Variant (Integer) indicating the result of a string comparison.

Syntax

StrComp(string1, string2[, compare])

The StrComp function syntax has these named arguments:

Part     Description
string1     Required. Any valid string expression.
string2     Required. Any valid string expression.
compare     Optional. Specifies the type of string comparison. The compare argument can be omitted, or it can be 0, 1 or 2. Specify 0 (default) to perform a BINARY COMPARISON. Specify 1 to perform a textual comparison. For Microsoft Access only, specify 2 to perform a comparison based on information contained in your database. If compare is Null, an error occurs. If compare is omitted, the Option Compare setting determines the type of comparison.
Return Values

If     StrComp returns
string1 is less than string2     -1
string1 is equal to string2      0
string1 is greater than string2      1
string1 or string2 is Null     Null

>

So in your case you should use
Select * from table where StrComp([X],'Y',0) = 0 if you want only 'Y'
Select * from table where StrComp([X],'y',0) = 0 if you want only 'y'

Good luck,
YP
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7281454

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - Answered by: YP
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 
LVL 28

Expert Comment

by:TextReport
ID: 7281556
Nic;o, the user is doing the query in cold fusion through ODBC to jet, I don't think any of this has addressed the issue from Cold Fusion as you can't call Access function through ODBC.

Cheers, Andrew
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7281626
Good point Andrew, overlooked that !

I'll change my recommandation into:

 - PAQ and points removed

Nic;o)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question