Solved

case-sensitive substring search in visual basic 6 on an access database

Posted on 2004-08-18
3
184 Views
Last Modified: 2013-12-25
I conect to the database with an AdoDB.Connection object
I use AdoDB.command and AdoDb.recordset to execute my queries and to retrieve the results.
I need to search a given text into a field from a table and i need this search to be case-sensitive:

My code looks like this:

cmnd = "select DISTINCT(lege.lege_id),lege_tip.presc,Repub_den.Denumire,lege.numar,lege.data,lege_emit.nume,lege.mo,lege.data_mo from lege,lege_emit,lege_tip,Repub_Den,lege_texte where lege.tip_id=lege_tip.tip_id and lege.emitent_id=lege_emit.emitent_id and repub_den.Repub=lege.Repub and lege_texte.lege_id=lege.lege_id and lege_texte.header LIKE " & "'%" & str & "%'"

Adodc1.recordsource=cmnd
adodc1.refresh

'Where Adodc1 is an Ado Data Control

So the question is how do i find a substring in a filed in case-sensitive way in this conditions?
0
Comment
Question by:pcornel2k
3 Comments
 
LVL 45

Accepted Solution

by:
aikimark earned 100 total points
ID: 11862429
You might have to use the INSTR() function instead of the LIKE clause.

Select Distinct ... Where ... InStr(1, lege_texte.header ," & str & ", 2) <> 0"
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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

762 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

18 Experts available now in Live!

Get 1:1 Help Now