Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

case sensitive select statement in Access 2000?

Posted on 2002-07-17
18
Medium Priority
?
311 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

722 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