Updating textbox with total from subform

G

Guest

I want to update a text box on a form with a total from a subform field
whenever the user updates the subform field. Using DSum in the AfterUpdate
event of the subform field, the main form text box is updated with the total
of the subform fields that represents the total BEFORE the entry was updated.
In other words, DSum is not including the new entry. Any suggestions?
 
A

Allen Browne

If you have a field named Amount, you can place a text box into the Form
Footer section, and set its ControlSource ot:
=Sum([Amount])
 
G

Guest

Thanks Allen. Actually, I am updating a field in another table. I can display
the data using the approach you suggest, but the field in other table is
still updated with the old value.

I have moved the DSum code to the On Exit event of the subform. The update
isn't done until the subform is existed, but that's OK. I'm sure there is
another way, but this way will suffice. Again, thanks.

Allen Browne said:
If you have a field named Amount, you can place a text box into the Form
Footer section, and set its ControlSource ot:
=Sum([Amount])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Paco said:
I want to update a text box on a form with a total from a subform field
whenever the user updates the subform field. Using DSum in the AfterUpdate
event of the subform field, the main form text box is updated with the
total
of the subform fields that represents the total BEFORE the entry was
updated.
In other words, DSum is not including the new entry. Any suggestions?
 

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