Solved

case sensitive select statement in Access 2000?

Posted on 2002-07-17
18
300 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
  • 6
  • 5
  • 3
  • +3
18 Comments
 
LVL 8

Expert Comment

by:dds110
Comment Utility
Have you tried using

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

Just a thought.
0
 
LVL 28

Expert Comment

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

Cheers, Andrew
0
 

Author Comment

by:labambina
Comment Utility
I am also working in Access
0
 

Author Comment

by:labambina
Comment Utility
I am using access 2000
0
 
LVL 28

Expert Comment

by:TextReport
Comment Utility
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
Comment Utility
thx andrew
I will check it and get back 2 u asap
0
 
LVL 2

Expert Comment

by:kiddiec
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

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

Expert Comment

by:TextReport
Comment Utility
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
Comment Utility
cold fusion.. u know like asp :)
0
 

Author Comment

by:labambina
Comment Utility
I use ODBC to connect
0
 
LVL 28

Expert Comment

by:TextReport
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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
Comment Utility
Good point Andrew, overlooked that !

I'll change my recommandation into:

 - PAQ and points removed

Nic;o)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now