martakeithy
Technical User
Hi,
I am attempting to write some Access Basic code with little progress. I wonder if anyone could advise.
I have a main form and a subform. The first form is called PaymentAmend and contains client bank details and the outstanding balance for the client.
The subform is called PaymentTendered and contains the date and details of each individual payment.
What I want to do is to transfer the value held in the outstanding balance field on the Mainform to the subform. This is to enable a new balance to be calculated when a payment is entered on the subform; i.e to give a figure from which to subtract the payment.
I want the first record: first payment on the subform to grab the value held on the main 'PaymentAmend' form.
I want subsequent records (records 2,3,4 etc...) on the subform to take the amended (new) balance from the previous record - not the outstanding balance from the main form.
I tried to write an if statement which I will paste below. I am working from a book here and am probably missing some vital information.
Private Sub Balance_GotFocus()
Dim Outstanding As Control
Dim CheckSum As Currency
Dim CurrentBal As Currency
Outstanding = Forms!PaymentAmend!Balance
CheckSum = Forms!PaymentAmend!BalancePlace
CurrentBal = Balance
If CurrentBal = 0 And CheckSum = 0 Then
Balance = Outstanding
Else: Balance = CheckSum
End If
End Sub
I would be very grateful of any help
Marta
I am attempting to write some Access Basic code with little progress. I wonder if anyone could advise.
I have a main form and a subform. The first form is called PaymentAmend and contains client bank details and the outstanding balance for the client.
The subform is called PaymentTendered and contains the date and details of each individual payment.
What I want to do is to transfer the value held in the outstanding balance field on the Mainform to the subform. This is to enable a new balance to be calculated when a payment is entered on the subform; i.e to give a figure from which to subtract the payment.
I want the first record: first payment on the subform to grab the value held on the main 'PaymentAmend' form.
I want subsequent records (records 2,3,4 etc...) on the subform to take the amended (new) balance from the previous record - not the outstanding balance from the main form.
I tried to write an if statement which I will paste below. I am working from a book here and am probably missing some vital information.
Private Sub Balance_GotFocus()
Dim Outstanding As Control
Dim CheckSum As Currency
Dim CurrentBal As Currency
Outstanding = Forms!PaymentAmend!Balance
CheckSum = Forms!PaymentAmend!BalancePlace
CurrentBal = Balance
If CurrentBal = 0 And CheckSum = 0 Then
Balance = Outstanding
Else: Balance = CheckSum
End If
End Sub
I would be very grateful of any help
Marta