Solved

Case-sensitive SQL Queries with Access Jet Engine

Posted on 1997-04-23
3
163 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
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
milton042297 earned 100 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 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

19 Experts available now in Live!

Get 1:1 Help Now