Add two fields in form

alex91

New member
Local time
Today, 13:04
Joined
Oct 16, 2008
Messages
9
Untitled.jpg


I have a form as you can see above. The TotalAmountPaid is a field in a table. When the member pays in some more money they type it in the AmountPaid text box.
I would like to be able to then add the AmountPaid to the TotalAmountPaid at the press of a button.
How would i do this (what code would i need)??
Many Thanks
Alex
 
Untitled.jpg


I have a form as you can see above. The TotalAmountPaid is a field in a table. When the member pays in some more money they type it in the AmountPaid text box.
I would like to be able to then add the AmountPaid to the TotalAmountPaid at the press of a button.
How would i do this (what code would i need)??
Many Thanks
Alex

The following code in the On Click Event of the Command13 Button will do this for you, but you could also put the same code in the On Exit Event of the AmountPaid Button and then the total would be updated as soon as the user pressed Enter.
Code:
    Me.TotalAmountPaid  = Nz(Me.TotalAmountPaid,0) + Nz(Me.AmountPaid,0)
    Me.AmountPaid=0

Note: This approach will leave a 0 int he AmountPaid Box. If you want to leave it Blank, you can use the following:
Code:
    Me.TotalAmountPaid  = Nz(Me.TotalAmountPaid,0) + Nz(Me.AmountPaid,0)
    Me.AmountPaid=Nothing
 
Last edited:
Thanks for the quick reply. That solution is exactly what i was looking for apart from i get an error saying the Recordset is not Updateable, i think that is because it is a form based on a query.
How would i get this to work?
Alex
 
Bob showed you how to do what you ask....But have you considered the long term? When you have a receivable, and someone is making payments, it tends to be rather important to know a bit more.... for example... The date, method of payment, and amount of payment. Historical data is rather important. Something for you to consider....
 
Thank you bith for the reply. I am not to worried about long term data at the moment. And some of the field in the query do use 'Group by' but there is no other Total that would do the job so am stumped for what to do to get this to work
Alex
 

Users who are viewing this thread

Back
Top Bottom