Solved

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

Posted on 2004-08-18
3
208 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

840 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