updating Tquery - params dont appear to change

I have 3 queries in an application. all are set to use cached updates . the
first reads orders that are not issued,
the second reads order details and the third reads stock information .
the second is set with parameters to be linked to the first and the third is
set with parameters to link to the second
the third query should give a single record result matching the part number
for the relevant order detail.

all seems fine when using components on a form - they all behave fine. I
then run a routine which
[1] sets the order date (q1) to now
[2] with first until eof - next loop increments the onorder value in q3 by
the value of order qty in q2
[3] sets the issued property of q1 to 'Y'
[4] uses database.applyupdates to commit the changes to the database

1 3 and 4 work fine, but during [2], the parameters linking q1 to q2 fail to
update, so the  record in q3 corresponding to the first record in q2
accumulates all the on order values

If I use a query which covers all the records in the stock file and use
locate to find the correct one that means running a query that will contain
around 10,000 - 20,000 records. if I use parambyname type query, then I must
close and open the query to reset the data - thus losing any cashed updates
how can I use my current setup and ensure that the record indicated in q3 is
related to the record in q2 and the parameters are correctly updated without
abandoning cached updates?

hope that made sense


John Perrett