Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-08-18
3
Medium Priority
?
233 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
1 Comment
 
LVL 46

Accepted Solution

by:
aikimark earned 400 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: 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Suggested Courses

876 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