Sum a field?

D

DJW

I want to obtain a sum of values in a field [AmountRecieved] on my subform.
I can do this correctly by placing the following =Sum([AmountRecieved]) in
the controlsource [Text16] of an unbound field on my subform. Next, I can
get it to return the correct value after I refresh the form in the "after
update" for the [AmountRecieved]. Now comes the problem....

I want to take that value that is in [Text16] after it displays the correct
value and subtract it from [AmountOwed] on the main form and enter result in
[Balance] both of which reside on my main form. Below is the example...

Me.Parent!Balance = Me.Parent!AmountOwed - Me.Text16

The problem I face is that [Balance] does not accurately update until the
next entry. In other words it is always one entry behind in displaying the
correct value. What am I doing wrong?

Ideally, I want to sum [AmountRecieved] on the subform, take that value and
subtract it from [AmountOwed] on my main form and have the result recorded
in [Balance] on my main form.

Any help greatly appreciated.
 
P

Penguin

On the AfterUpdate property of your [AmountReceived] add this code:

Forms!FormName.Recalc

Replace FormName with the main forms name.
 

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