FindKey never finds key 
Author Message
 FindKey never finds key

I appreciate anyone's help on this one...

I have a database set up in Access 97 with two tables.  I am needing
to find a zipcode from one table (store table) in the other (zipmaster
table).  I can run a query in Access and get the correct information,
but I am having trouble duplicating it in delphi 5.  In both tables,
the zipcode field (defined as text) is the primary index and are
related one-to-many (zipmaster to store).  It would be simple to just
run the Access query to get my results, but not all stores have a good
key match in the zipmaster and I perform other routines on those.  I
used FindKey - i.e. ZipMasterTable.FindKey([StoreTable['ZipCode']]) -
and it never finds the matching keys.  Any ideas?  I have been mulling
over this for the past five days and am about ready to throw in the
towel.

Thanks in advance...

dj



Wed, 23 Nov 2005 03:00:31 GMT  
 FindKey never finds key
Have you tried using Locate instead of FindKey?


Sat, 26 Nov 2005 00:57:23 GMT  
 FindKey never finds key

Quote:

> Have you tried using Locate instead of FindKey?

Locate works, but it takes an hour to find one record!


Sun, 27 Nov 2005 00:18:42 GMT  
 FindKey never finds key


Quote:

>> Have you tried using Locate instead of FindKey?

>Locate works, but it takes an hour to find one record!

Could you post the table structures and the Access query that worked
OK. How big are the tables? Any other info on what you are trying to
do would help, too.

Dan



Sun, 27 Nov 2005 03:46:47 GMT  
 FindKey never finds key



Quote:





Quote:
> >> Have you tried using Locate instead of FindKey?

> >Locate works, but it takes an hour to find one record!

I don't have this response on my news server, so I'll respond here.

If Locate takes an hour to find one record, then I would suspect that the
field is not the first field in any index on the table. From my D5 help

"Locate uses the fastest possible method to locate matching records. If the
search fields in KeyFields are indexed and the index is compatible with the
specified search options, Locate uses the index. Otherwise Locate creates a
filter for the search."



Mon, 28 Nov 2005 01:14:55 GMT  
 FindKey never finds key

Quote:







> > >> Have you tried using Locate instead of FindKey?

> > >Locate works, but it takes an hour to find one record!

> I don't have this response on my news server, so I'll respond here.

> If Locate takes an hour to find one record, then I would suspect that the
> field is not the first field in any index on the table. From my D5 help

> "Locate uses the fastest possible method to locate matching records. If the
> search fields in KeyFields are indexed and the index is compatible with the
> specified search options, Locate uses the index. Otherwise Locate creates a
> filter for the search."

Thank you all for your help...  I took a chance and reloaded the data
for the database changing my primary key from text to an integer.
That seemed to be the problem because FindKey found all good matches
and FindNearest found the closest match on 2800 records in 1.5
minutes.  BTW, the main search table contains over 23 million unique
entries!

c-ya
dj



Tue, 06 Dec 2005 20:21:04 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Findkey won't find key

2. Findkey won't find key

3. FindKey does not always find a record

4. FindKey on Composite Key

5. FindKey with a partial key

6. Q: using findkey with mult keys

7. Finding key words in a field

8. How to find your primary key in interface

9. find primary key against database server table?

10. 'Could not find PRIMARY KEY...

11. finding primary key fields in ORACLE database

12. Find Next Key

 

 
Powered by phpBB® Forum Software