Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 68
A macro to Count the number of rows across all worksheets 3 82
Run code from text file in vb 1 56
TT Auto Dashboard 13 83
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 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

15 Experts available now in Live!

Get 1:1 Help Now