Query from a Query, into a Query

This looks complicated, but it cant be that bad..

I am having trouble with the application I'm trying to create. I have two
tables, Cars and Payments. I want to make a query which will list all of the
payments made on a particular car, and also subtract the total of the
payments from  a total which is stored as a column in Cars.

I made a counter query object, with the SQL statement
SELECT SUM(Amount) from PAYMENTS where Car_ID = :Which

then inside of my OnCalcFields of the Car table, I put:

CountQuery.Params[0].AsInteger := CarTable['CAR_ID'];
CountQuery.Open;
CarTable['Balance']  :=  (CarTable['charge'] - CountQuery['SUM']);
CountQuery.Close;

Now when I run this, my grid which is supposed to contain my result set(from
a TABLE),  which is calling this function, is empty.. its as if the first
query is being killed because of my CountQuery.Open.. if I take that out, it
all works great but I also cant subtract the SUM from the balance. If I get
rid of the CarTable['Balance'] line, it still doesnt work, so thats not the
line screwing things up.

Can somebody please help me out with this, its driving me nuts! :)

Dan Chase
dan...@creators.org