Posted on 2006-05-24
Last Modified: 2008-01-09
I would like to make a search function on a dataset which makes a partial comparison of the ginen string (aFindDialog.FindText ). I try using the Locate function but I always get the first record matching the text whereas I want to proceed to the next matching record if there are more than one. So I always get to be shown the first matching record of the dataset and can't move on the next one. The database is Access..

My Code is:

  Result := False
  if aFindDialog.FindText <> '' then
        Result := Tadodataset(aFindDataset).Locate (aFindFieldName, aFindDialog.FindText, [loPartialKey, loCaseInsensitive]);
Any ideas?
Question by:mc94051
    LVL 3

    Accepted Solution

    LVL 15

    Expert Comment

    Yes locate will find the first match, but you can just re-run it to move to the next match.

    1) find first match
    2) move to next record (check not at end of dataset) - must move to next record or it will keep matching the current one
    3) re-run match

    You can keep doing this until you hit the end of the dataset

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    729 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

    17 Experts available now in Live!

    Get 1:1 Help Now