Seek Nearest Match if exact match not found ? 
Author Message
 Seek Nearest Match if exact match not found ?

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



Tue, 23 Mar 2004 16:15:54 GMT  
 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



Wed, 24 Mar 2004 20:57:38 GMT  
 Seek Nearest Match if exact match not found ?
Hi Luqman,

As the "Set Near On" is implemented by the specific engine in Foxpro, there
is no such corresponding function in ADO. You have to write code to
implement this function manually.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copy Right, 2001 Microsoft Corporation. All rights reserved.

Regards,
Kally Wang
Microsoft Support Engineer

==Original Message==

Subject: Seek Nearest Match if exact match not found ?
Date: Fri, 5 Oct 2001 13:15:54 +0500
Newsgroups: microsoft.public.vb.database.ado

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



Fri, 09 Apr 2004 22:03:22 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Seek Nearest Match if exact match not found ?

2. Using FIND method to get Exact match

3. using Find Method for Exact match

4. non-exact matches

5. exact matches in an array

6. Exact match in array?

7. RegExp question: match within another match

8. Filefirstfile api , find in win95 and dos dir /s do not match

9. How to refresh Form after seek method match

10. Seek sometimes doesn't match record

11. Finding records that don't match

12. Testing to see if a filter found any matches

 

 
Powered by phpBB® Forum Software