Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Substracting values on one form from it's subform

Status
Not open for further replies.

Viv1

Programmer
Dec 9, 2003
42
GB
I have a main form called Member with a subform called Member_Payments Subform linked by the Primary key MembershipNo. The subform shows all payments made by the member currently shown on the Member form. A field called Running_Balance on the Member form needs to show whether a payment has been entered and submitted in the subform. I think a command button to ‘submit’ the payment is the best option and the subform is a tabular layout so a button could be at the end of each record or in the header (with reference to the most recent payment being used in the calculation).

I have some fields for calculation in the Member form to allow for the Running_Balance calculations. E.g. if the amount paid into the subform is less than the Running_Balance there will be a balance > £0.

I am having some difficulties with the coding of this as I haven’t used VBA before, I can see the logic but cannot understand how to make the correct payment be subtracted from subform to the main form.

If anyone can help me I’d be very grateful,

Thanks Viv
 
Viv
Try something like this...
I have an Invoice form, with an Invoice Details subform. On the Invoice form, there is a text box which has the following formula...
=Nz([tblInvoiceDetails].[Form]![txtInvoiceSubtotal],0)

This grabs the subtotal from the subform. Then you could subtract this amount from the current running balance on the main form. The Nz function tests for no entry in the subform.

Hope that helps.

Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top