Clear Public Variables Upon Query Run

B

brancazio95

I'm using public variables to store cumulative totals that are returned
to a query via a function. For example, the query returns something
like this

Value Total
1 1
2 3

A function is run on each line of data that adds the value from the
current record to the cumulative total in the public variable and
returns the new total from the public variable to the query.

I would like to reset the public variables when the query is run so
that they start from 0. I have not found an easy way to do this. The
only way I've figured out so far is to pass an autonumber to the
function, and when ID = 1, the function contains special logic that
resets the public variables. This solution was fine when I only had
one group of related records in the query, but now I need to handle
multiple groups of related records.

Anyone have any ideas?
 
D

Douglas J. Steele

How are you invoking the query? Simply set the variables to 0 before you do
that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top