Strange error with TQuery

(Sorry if this is a double posting; I got no replies in 4 days so maybe
my posting didn't come through)

I am using Delphi 2.0 Developer with a Paradox 7 table "Customers".  It
has the fields CustID (long integer) and CustType (short).  

CustType is defined as a secondary index for the table.

In design mode I place a new TQuery object on a form.  I set the
Database property as a valid database name.  In the SQL property I type:

SELECT CustID FROM Customers WHERE CustType = 5

I create a TDataSource and a TDBGrid to show the result of the query.
Then I set the Active property to "True".  This is where the problem
occurs: I get an "Invalid floating point operation" exception.

I have pin-pointed the problem to the combination of the WHERE clause
and defining a field as a secondary index in the Paradox table. I have
come to this conclusion simply because:

- if I omit the WHERE clause I get no error
- if I remove the secondary index CustType I get no error

However, the same query always works well in Database Desktop as an SQL
file, even *with* the WHERE clause *and* the secondary index. But in my Delphi
program I always get the error.

Is this a feature or a bug? And how can I fix it?

I need to have CustType as a secondary index because I define
referential integrity to another table with that field.

I'd be very glad for any ideas or solutions.

Yours,

Antti Kaihola

-------------------------------------------------------------------
Antti.Kaih...@siba.fi  http://www.helsinki.fi/~akaihola/
Helsinki Univ. Department of Musicology;  Sibelius-Academy