Summing totals in subform

  • Thread starter Thread starter Paul Doree
  • Start date Start date
P

Paul Doree

Hi,

I have a mainform and a subform. In the subform footer there is a control
(ctlMaterialsTotal) which sums the materials cost field in the subform i.e.
=Sum(MaterialsCost)

On the main form I have a button which generates an invoice and there are a
few checking routines built into it, one of which relies on the value in
ctlMaterialsTotal

The problem I keep on running into is that the ctlMaterialsTotal only gets
updated when the user actually physically updates the current record in the
subform (i.e. tabs to the next row), so the routines which are called from
the button on the main form always 'see' the previous value. I have tried
all sorts of ways to force the ctlMaterialsTotal to update to the latest
value such as refresh, requery etc.but cannot get it to work.

Any suggestions anyone - it's driving me nuts!


Paul
 
try putting a "requery calculated control" action in the AfterUpdate event
of *each control* in the subform where a user may add or change data that is
used in the calculated control.

hth
 
Back
Top