Assigning a previous fieldvalue to a field in the next record
- by user2945849
I am working on a loan amortization schedule using Access, I have created the following tables:
tblMembers - autoMemberID|txtLN|txtFN|etc
tblLoans - autoLoanID|numMemberID|etc
tblSchedules -autoScheduleID|numLoanID|numPayment#|datDue|dblBegin|...|dblEnd
tblPayments - autoPaymID|numLoanID|curAmtPaid|datPaidDate
and forms:
frmLoans - autoLoanID|etc
sbfSchedules - numPaymID|datDue|dblBegin|...|dblEnd
sbfPayments - dblAmount|datPaid
I have been able to generate the schedule (using DAO recordset) clicking a btnRepaymentSchedule the challenge is when I click a btnAddPayment still on the sbfSchedules, I want the value of the dblEnd field to be the value of the next record dblBegin field! I have tried using
dlookup(txtBeginBalance = Dlookup("EndBalance", _
"Schedules","[ScheduleID] = Form![Schedules]![ScheduleID]-1)
but there is no effect but if I use
txtBeginBalance = txtEndBalance
the value of txtEndBalance is assigned to the value of txtBeginBalance of the same record (want next record).
Secondly, how can I set focus to the next record if a contro(txtAmountPaid) is not null on clicking the btnAddPayment or assigning the value of a calculation when the control is 0 or null ?
Thanks