update form after subform

Bioman

Registered User.
Local time
Today, 12:53
Joined
Feb 28, 2002
Messages
29
How can I update a field in a form after an AfterUpdate event of a field in the subform. When I create a new record in the subform, I want that this new data update a field in the form.

Thanks
 
Sounds like you have it back to front. You add new records to the Main form (the One side of the equation) then add records to the subform (Many side).
 
The One side (main form) is the number of a bill. In the main form I have too some calculated field like total of payment. In the subform, I have the payments linked to the bill. I want that if I create a new payment, the total in the mainform is updated.
 
In the footer of your subform make a textBox called txtSub =Sum([txtPayment]). Make the footer not visible. Now in your main form txtTotal make the control source = [your subform name].[Form]![txtSub].
 
The problem is that before I type a new payment, the value of the field is null and the sum is not done. So in the main form, the field will be empty until I type a payment. But this field is used to calculate an other field.
 
=Nz([your subform name].[Form]![txtSub],0)
Should populate your field with 0 if null and the desired sum if not zero. Your other calculations should now work.
 

Users who are viewing this thread

Back
Top Bottom