?
Solved

Case-sensitive SQL Queries with Access Jet Engine

Posted on 1997-04-23
3
Medium Priority
?
189 Views
Last Modified: 2012-08-14
How do I get the VB4 Access Jet Engine to do case-sensitive queries? Eg.

SELECT * FROM someTable WHERE someField = 'i'

Here "someField" is assumed to be a text field, and I would like only 'i' records (and not 'I' records) to be returned. The default behaviour seems to be case-insensitive.
0
Comment
Question by:seumas
[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
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
milton042297 earned 200 total points
ID: 1425662
Your problem will be solve now ...

Use the "Like" operator instead "=".
This example returns a list of employees whose names begin with the letters A through D.
 
SELECT * FROM Employees WHERE LastName Like "[A-D]*"

 
The following table shows how you can use Like to test expressions for different patterns.
 
Kind of match              Pattern       Match (returns True)      

Multiple characters      "a*a"              "aa", "aBa", "aBBBa"      
                      "*ab*"              "abc", "AABB", "Xab"      

Special character      "a[*]a"              "a*a"      
Multiple characters      "ab*"              "abcdefg", "abc"      
Single character      "a?a"              "aaa", "a3a", "aBa"      
Single digit              "a#a"              "a0a", "a1a", "a2a"      
Range of characters      "[a-z]"              "f", "p", "j"      
Outside a range              "[!a-z]"      "9", "&", "%"      
Not a digit              "[!0-9]"      "A", "a", "&", "~"      
Combined              "a[!b-m]#"      "An9", "az0", "a99"      


Good Luck...
0
 
LVL 1

Expert Comment

by:milton042297
ID: 1425663
Sorry seumas but the table is not well, but you can get this table, on VB help.
0
 

Author Comment

by:seumas
ID: 1425664
Hi,

I tried out this solution and it didn't work. The "Like" operator works fine in plain VB code, but in an SQL statement it is still case-insensitive. I got a solution from the newsgroup however:

SELECT * FROM someTable
WHERE someField = 'i'
AND StrComp([someField],'i',0) = 0 ;

Seumas
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

771 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