Doing a partial (not exact match) search in a database - testing whether I've found a match

Martin Underwood <martin.underw...@{*word*269}.net> wrote in article
<01bd1530$61457f80$LocalHost@mu>...

Quote
> How do I test whether a partial (not an exact) search has found a match?

> If I was searching for an exact match (an implied
> "if required-value = value-in-index" test), I could use GoToKey and then
> test its return value:

> Table.SetKey;
> Table.Fields[0].AsString := required_value;
> if Table.GoToKey then
>   { value found }
> else
>   { value not found }

> However the only way that I can do a partial match (an implied
> "if required-value = left(value-in-index, len(required-value))" test) is
> to use GoToNearest, but this does not seem to return a boolean value (ie
> "if Table.GoToNearest then" is not syntactically correct). Empirically,
> GoToNearest always seems to find the first partial match if one is
> present, but how do I tell if there is no partial match?

I actually worked this out for myself after I posted the question. I
thought I'd reply to my own posting in case anyone else is interested.

Having done the GoToNearest, all I need to do is to test whether the value
of the linking field in the table that I am searching matches the one that
I'm looking for! Obvious, really!