Board index » delphi » Using Locate on a Microsoft Access database, looking for more than one indexed field value

Using Locate on a Microsoft Access database, looking for more than one indexed field value

I am using a Microsoft Access database through DAO (the MSACCESS driver with
the BDE).  When I perform a Locate on two indexes (ex.
Locate('Field1;Field2',VarArrayOf([10,'Blap']),[]); ), I am told that both
are not indexes (while both are).  I believe the documentation claims that
Locate will use whatever method is possible regardless, but nonetheless, in
this case both are indexes.  If I locate on either individually, it works
perfectly.

Is this a problem with the Access driver, with DAO, etc?  As a sidenote, I
then used the msAccess driver (the ODBC one), and it actually returns false
to EVERY locate (I've double checked, and the files I am trying to Locate
are there).  This is very odd.

Any ideas?

 

Re:Using Locate on a Microsoft Access database, looking for more than one indexed field value


If you want to search using two fields, you must have an index defined that
is composed of both fields. It won't work if you have one index with one
field, another index with the other field.

Juan

Quote
Dennis Forbes wrote in message <68dm6u$q...@forums.borland.com>...
>I am using a Microsoft Access database through DAO (the MSACCESS driver
with
>the BDE).  When I perform a Locate on two indexes (ex.
>Locate('Field1;Field2',VarArrayOf([10,'Blap']),[]); ), I am told that both
>are not indexes (while both are).  I believe the documentation claims that
>Locate will use whatever method is possible regardless, but nonetheless, in
>this case both are indexes.  If I locate on either individually, it works
>perfectly.

>Is this a problem with the Access driver, with DAO, etc?  As a sidenote, I
>then used the msAccess driver (the ODBC one), and it actually returns false
>to EVERY locate (I've double checked, and the files I am trying to Locate
>are there).  This is very odd.

>Any ideas?

Re:Using Locate on a Microsoft Access database, looking for more than one indexed field value


Quote
Dennis Forbes wrote:

>Is this a problem with the Access driver, with DAO, etc?  As a sidenote, I
>then used the msAccess driver (the ODBC one), and it actually returns false
>to EVERY locate (I've double checked, and the files I am trying to Locate
>are there).  This is very odd.

1. Both fields must be in the same index.

2.  The BDE driver that ships with Delphi 3 does not work with Access 97
(ie. DAO 3.5).
      It will work with the Access 95 (DAO 3.0),

I spent several frustrating hours trying to figure out why I couldn't "Find"
records that I knew were there and that  worked just fine on the same
database in Paradox. I finally got wise and read Delphi 3's  readme.txt.
Guess what? The readme has a whole section dedicated to the Access Driver
!@!#$

Quote
>The Access driver does not support DAO 3.5 (Access 97). If you
>upgrade Access 95 to Access 97, DAO 3.0 still resides on your
>machine, so the driver will function correctly. If you install
>Access 97 with no prior version of Access 95, the driver will
>not function.

Borland has recently posted updates to the BDE on their web site. The
updated BDE does support Access 97 & DAO 3.5.  Once I applied the update my
problems went away.  I don't remember the URL but I did a search on BDE and
Access to find it.

Kendall

Other Threads