Sum in Continious Form Footer Delayed Update

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a textbox field Units that is displayed along with a description. I
have a unbound textbox in the footer with a control source of =Sum([Units]).
The sum is calculated correctly however it will only update when moving
between records in the continuous form. I tried to use a DoCmd.Save on in the
AfterUpdate subroutine with no change in behavior. How can I make the total
units textbox update after an individual unit textbox has updated? Thank you.
 
Edward said:
I have a textbox field Units that is displayed along with a description. I
have a unbound textbox in the footer with a control source of =Sum([Units]).
The sum is calculated correctly however it will only update when moving
between records in the continuous form. I tried to use a DoCmd.Save on in the
AfterUpdate subroutine with no change in behavior. How can I make the total
units textbox update after an individual unit textbox has updated? Thank you.


You can requery the form to both save the record and
recalculate the aggregate functions. Since the form's
dataset is being changed, the first record will become the
current record so you will have to find the record you were
working in before:

Dim lngPK As Long 'type of primary key field
lngPK = Me.PK 'PK is name of primary key field
Me.Requery
With Me.recordsetClone
.FindFirst "PK = " & lngPK
If Not .NoMatch Then Me.Bookmark = .Bookmark
End With
 

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

Back
Top