
Seek Nearest Match if exact match not found ?
This is a truly great concept. IS NEARLY.
Equals, Not equals, perhaps.
In reality, you could easily do this with a sql statement, though not with
seek:
Basically you are looking for the smallest difference between your field and
your required value
SELECT TOP 1 Field1, ABS(Field1-12) FROM TABLE ORDER BY Field1-12
To return the record that has that value:
SELECT * FROM TABLE A WHERE EXISTS(SELECT TOP 1 Field1, ABS(Field1-12) FROM
TABLE B ORDER BY Field1-12 WHERE A.PrimeKey= B.PrimeKey )
Quote:
> Using Seek of ADO, If I search for 12 and it is not found, the match
should
> return nearest to the match say, 11 or 14. Is it possible ?
> Just like "Set Near On" command in Foxpro.
> Best Regards,
> Luqman