Requery of Accumulator Control on Form

R

Roy

I am using a form for data entry. The form has a field for a "Trans Amount".

On the form I have an accumulator that is summing the "Trans Amount" control
for all records that have been entered during the data entry session.

For the current record, after I enter the "Trans Amount" field, I want to
requery the accumulator and have it update the total to include the current
record, before I move to the next record.

For the life of me, I cannot get the accumulor to include the current
records "Trans Amount" control total until I move to the next record. While I
am in the current record, my requery of the accumulator control does not work
at all.

Does anyone know what this problem is?
 
D

Dirk Goldgar

Roy said:
I am using a form for data entry. The form has a field for a "Trans
Amount".

On the form I have an accumulator that is summing the "Trans Amount"
control
for all records that have been entered during the data entry session.

For the current record, after I enter the "Trans Amount" field, I want to
requery the accumulator and have it update the total to include the
current
record, before I move to the next record.

For the life of me, I cannot get the accumulor to include the current
records "Trans Amount" control total until I move to the next record.
While I
am in the current record, my requery of the accumulator control does not
work
at all.

Does anyone know what this problem is?


Until the current record has been saved, its [Trans Amount] isn't stored in
the table, so no control that does a Sum() or DSum() will see that value.
You have to either force the record to be saved and then requery the
"accumulator" control, or else set the controlsource of the accumulator to
something like this:

=Sum([Trans Amount])+IIf([NewRecord],Nz([Trans Amount],0),0)
 

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