Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

search in DBGRID

Posted on 1997-12-22
5
Medium Priority
?
223 Views
Last Modified: 2008-02-01
here is the question :->
say I have retrieved 100s of rows of data in dbgrid eg names of employees,now I want to find eg John smith , one way to do this is to force the user to look through rows and find it OR we may give them the find option as in MS word, but how can I put the cursor to that particular column matching the search result and make that column highlighted?

any suggestions?
0
Comment
Question by:mabo
[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
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1446522
With only 100 rows you can use Data.recordset.findfirst. Then put the cursor to a column using the col property
0
 

Author Comment

by:mabo
ID: 1446523
will this allow wild card search as well?
eg if someone is searching for Smith then SmithField should be
highlighted as well.
any comments?......


0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1446524
You can use any pattern that is valid in recordset's search. When to record is found, no matter what the criteria is, the dbgrid's current record set t the record that was found. Then you just need to put the selection to the column you were searching using the .cols proprty. If you post a specific situation, i will give a sample code.
0
 

Author Comment

by:mabo
ID: 1446525
ok, just have a look at the VB5 find facility, it has wild card
match, exact match etc, I am looking for something similar to that.
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 20 total points
ID: 1446526
You can do that using the Like operator:
Data.RecordSet.FindFirst "LastName Like Sm*"

Will find the record that it's LastName begins with sm.
Take a closer look at the Like operator in VB's help
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
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…
Suggested Courses

719 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