Solved

Search Recordset for substrings

Posted on 2004-08-11
2
331 Views
Last Modified: 2010-05-02
Hi,
I am retrieving data form a SQL Server database in a VB6 ADO program.

SELECT NAME FROM TABLE1 WHERE NAME like " & sql1 & " ORDER BY NAME
sql1 contains the first 2 digits from a user entered string

I am searching the recordset with
rec2.Find "Name= '" & txtsearch & "' "
to position on the full user entered string (contained in txtsearch)

This works fine, if the user enters the complete name. If the user enters only a few digits, I would like to position on the first occurence of this substring.

Thanks for your help
TKL1960
0
Comment
Question by:TKL1960
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 125 total points
ID: 11770686
The Find method supports wildcard searches. So you can use something like:

   rec2.Find "Name Like '*" & txtsearch & "*'"

To find anything containing the substring specified in txtsearch.

Hope this helps.
0
 

Author Comment

by:TKL1960
ID: 11770836
Thanks for your quick answer. Works fine.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 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