Assigning a previous fieldvalue to a field in the next record

Posted by user2945849 on Stack Overflow See other posts from Stack Overflow or by user2945849
Published on 2013-11-02T02:20:46Z Indexed on 2013/11/02 9:54 UTC
Read the original article Hit count: 217

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about forms

Related posts about vba