update textbox with total

  • Thread starter Thread starter John
  • Start date Start date
J

John

Have a continuous subform. Two fields in each record are Qty and
UnitPrice, both are bound. There is also a field called Cost, also
bound. When the Qty changes and go to new record, Cost updates. In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]). If any of the records change the Cost
updates but the unbound txtbox Subtotal does not. Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal. Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.

Is there a way to have the Subtotal update automatically?

.... John
 
Have a continuous subform. Two fields in each record are Qty and
UnitPrice, both are bound. There is also a field called Cost, also
bound. When the Qty changes and go to new record, Cost updates. In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]). If any of the records change the Cost
updates but the unbound txtbox Subtotal does not. Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal. Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.

Is there a way to have the Subtotal update automatically?

... John

Requery just the textbox:

Me!Subtotal.Requery

in the AfterUpdate event of Cost (or each control which can affect the
control). Or use Me.Recalc rather than Me.Requery - it will redo all
calculated controls but won't move the focus to the first record.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
Have a continuous subform.  Two fields in each record are Qty and
UnitPrice, both are bound.  There is also a field called Cost, also
bound.  When the Qty changes and go to new record, Cost updates.  In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]).  If any of the records change the Cost
updates but the unbound txtbox Subtotal does not.  Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal.  Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.

Is there a way to have the Subtotal update automatically?

... John

Use After Update or On Dirty event in the unbound box to point to
Me.Requery button code...
 
Have a continuous subform.  Two fields in each record are Qty and
UnitPrice, both are bound.  There is also a field called Cost, also
bound.  When the Qty changes and go to new record, Cost updates.  In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]).  If any of the records change the Cost
updates but the unbound txtbox Subtotal does not.  Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal.  Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.
Is there a way to have the Subtotal update automatically?

Requery just the textbox:

Me!Subtotal.Requery

in the AfterUpdate event of Cost (or each control which can affect the
control). Or use Me.Recalc rather than Me.Requery - it will redo all
calculated controls but won't move the focus to the first record.
--

             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com


The Me!Subtotal.Requery did not update the textbox. I tried in the
subforms afterupdate event and it didn't work there either. The
Me.Recalc in the subforms AfterUpdate event moved the focus to the
first record. It did update the Subtotal textbox.
Other thoughts?
.... John
 
Have a continuous subform.  Two fields in each record are Qty and
UnitPrice, both are bound.  There is also a field called Cost, also
bound.  When the Qty changes and go to new record, Cost updates.  In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]).  If any of the records change the Cost
updates but the unbound txtbox Subtotal does not.  Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal.  Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.
Is there a way to have the Subtotal update automatically?
... John
Requery just the textbox:

in the AfterUpdate event of Cost (or each control which can affect the
control). Or use Me.Recalc rather than Me.Requery - it will redo all
calculated controls but won't move the focus to the first record.
--
             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com

The Me!Subtotal.Requery did not update the textbox.  I tried in the
subforms afterupdate event and it didn't work there either.  The
Me.Recalc in the subforms AfterUpdate event moved the focus to the
first record.  It did update the Subtotal textbox.
Other thoughts?
... John- Hide quoted text -

- Show quoted text -

Try changing control source of unbound subtotal to
=Sum([QTY]*[UnitPrice]) then change the on lost focus events of qty
and unitprice to me.requery...
 
Have a continuous subform.  Two fields in each record are Qty and
UnitPrice, both are bound.  There is also a field called Cost, also
bound.  When the Qty changes and go to new record, Cost updates.  In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]).  If any of the records change the Cost
updates but the unbound txtbox Subtotal does not.  Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal.  Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.
Is there a way to have the Subtotal update automatically?
... John
Requery just the textbox:
Me!Subtotal.Requery
in the AfterUpdate event of Cost (or each control which can affect the
control). Or use Me.Recalc rather than Me.Requery - it will redo all
calculated controls but won't move the focus to the first record.
--
             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com
The Me!Subtotal.Requery did not update the textbox.  I tried in the
subforms afterupdate event and it didn't work there either.  The
Me.Recalc in the subforms AfterUpdate event moved the focus to the
first record.  It did update the Subtotal textbox.
Other thoughts?
... John- Hide quoted text -
- Show quoted text -

Try changing control source of unbound subtotal to
=Sum([QTY]*[UnitPrice]) then change the on lost focus events of qty
and unitprice to me.requery...- Hide quoted text -

- Show quoted text -

Private Sub QTY_GotFocus()
Me.Requery
End Sub

Private Sub UnitPrice_LostFocus()
Me.Requery
End Sub
 
Have a continuous subform.  Two fields in each record are Qty and
UnitPrice, both are bound.  There is also a field called Cost, also
bound.  When the Qty changes and go to new record, Cost updates.  In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]).  If any of the records change the Cost
updates but the unbound txtbox Subtotal does not.  Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal.  Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.
Is there a way to have the Subtotal update automatically?
... John
Requery just the textbox:
Me!Subtotal.Requery
in the AfterUpdate event of Cost (or each control which can affect the
control). Or use Me.Recalc rather than Me.Requery - it will redo all
calculated controls but won't move the focus to the first record.
--
             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com
The Me!Subtotal.Requery did not update the textbox.  I tried in the
subforms afterupdate event and it didn't work there either.  The
Me.Recalc in the subforms AfterUpdate event moved the focus to the
first record.  It did update the Subtotal textbox.
Other thoughts?
... John- Hide quoted text -
- Show quoted text -

Try changing control source of unbound subtotal to
=Sum([QTY]*[UnitPrice]) then change the on lost focus events of qty
and unitprice to me.requery...- Hide quoted text -

- Show quoted text -

Private Sub QTY_LostFocus()
Me.Requery
End Sub

Private Sub UnitPrice_LostFocus()
Me.Requery
End Sub
 
Have a continuous subform.  Two fields in each record are Qty and
UnitPrice, both are bound.  There is also a field called Cost, also
bound.  When the Qty changes and go to new record, Cost updates.  In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]).  If any of the records change the Cost
updates but the unbound txtbox Subtotal does not.  Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal.  Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.
Is there a way to have the Subtotal update automatically?
... John
Requery just the textbox:

in the AfterUpdate event of Cost (or each control which can affect the
control). Or use Me.Recalc rather than Me.Requery - it will redo all
calculated controls but won't move the focus to the first record.
--
             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com

The Me!Subtotal.Requery did not update the textbox.  I tried in the
subforms afterupdate event and it didn't work there either.  The
Me.Recalc in the subforms AfterUpdate event moved the focus to the
first record.  It did update the Subtotal textbox.
Other thoughts?
... John- Hide quoted text -

- Show quoted text -

Try changing control source of unbound subtotal to
=Sum([QTY]*[UnitPrice]) then change the on lost focus events of qty
and unitprice to me.recalc...
 
Have a continuous subform.  Two fields in each record are Qty and
UnitPrice, both are bound.  There is also a field called Cost, also
bound.  When the Qty changes and go to new record, Cost updates.  In
the footer of the subform is an unbound textbox (Subtotal) with a
control source of =Sum([Cost]).  If any of the records change the Cost
updates but the unbound txtbox Subtotal does not.  Best I've come up
with is Me.Requery in a button next to the unbound txtbox that will
update the Subtotal.  Users seem to be getting frustrated in that they
do not see the Subtotal update after each change the Cost field has.
Is there a way to have the Subtotal update automatically?
... John
Requery just the textbox:
Me!Subtotal.Requery
in the AfterUpdate event of Cost (or each control which can affect the
control). Or use Me.Recalc rather than Me.Requery - it will redo all
calculated controls but won't move the focus to the first record.
--
             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com
The Me!Subtotal.Requery did not update the textbox.  I tried in the
subforms afterupdate event and it didn't work there either.  The
Me.Recalc in the subforms AfterUpdate event moved the focus to the
first record.  It did update the Subtotal textbox.
Other thoughts?
... John- Hide quoted text -
- Show quoted text -

Try changing control source of unbound subtotal to
=Sum([QTY]*[UnitPrice]) then change the on lost focus events of qty
and unitprice to me.recalc...- Hide quoted text -

- Show quoted text -


I used the subforms afterupdate event and the subtotal txtbox
updates. All I need now is to keep the continuous form from going
back to the top to the first record.
Suggestions?
 
I used the subforms afterupdate event and the subtotal txtbox
updates. All I need now is to keep the continuous form from going
back to the top to the first record.

That will happen if you requery the Subform; I was suggesting instead just
requerying the Textbox. Perhaps you could post your code.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
Back
Top