update textbox with total

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

I'm using
Me.txtTextBox1.ControlSource = "Staff"
Me.txtTotal.Requery
Me.txtTotal.Value = DSum("Staff", "Table1")

to calculate total for txtTextBox1 on a continuious form.

When data is changed in txtTextBox1 I'm trying to use the
following:
Private Sub txtTotal_AfterUpdate()
Dim intDoEvents

Me.txtTotal.Requery
Me.txtTotal.Value = DSum("Staff", Table1)
intDoEvents = DoEvents
Me.Repaint

End Sub
But, it doesn't update the txtTotal on the Form.

Could you please advise how could I update this value in
associated Table1 and the txtTotal with the changing in
txtTextBox1 on the Form. I think, I can use DAO,
recordset, edit, and update. But, may be there is some
simpler way of doing this.

Thanks

Thanks
 
I didn't mention that when I close the form and open it
again txtTotal appeares updated. But, without closing and
opening the Form it's not updated.
 
When data is changed in txtTextBox1 I'm trying to use the
following:
Private Sub txtTotal_AfterUpdate()
Dim intDoEvents

Me.txtTotal.Requery
Me.txtTotal.Value = DSum("Staff", Table1)
intDoEvents = DoEvents
Me.Repaint

End Sub
But, it doesn't update the txtTotal on the Form.

Instead of Me.txtTotal.ReQuery do a Me.Recalc.
 

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