我正在使用Access
制定贷款摊还计划,我创建了以下表格:
tblMembers - autoMemberID|txtLN|txtFN|etc
tblLoans - autoLoanID|numMemberID|etc
tblSchedules -autoScheduleID|numLoanID|numPayment#|datDue|dblBegin|...|dblEnd
tblPayments - autoPaymID|numLoanID|curAmtPaid|datPaidDate
和表格:
frmLoans - autoLoanID|etc
sbfSchedules - numPaymID|datDue|dblBegin|...|dblEnd
sbfPayments - dblAmount|datPaid
我已经能够生成时间表(使用DAO recordset
)点击btnRepaymentSchedule
挑战是当我点击btnAddPayment
上的sbfSchedules
时,我希望dblEnd
字段的值为下一个记录dblBegin
字段的值!我尝试过使用
dlookup(txtBeginBalance = Dlookup("EndBalance", _
"Schedules","[ScheduleID] = Form![Schedules]![ScheduleID]-1)
但是如果我使用
则没有效果txtBeginBalance = txtEndBalance
将txtEndBalance
的值分配给同一记录的txtBeginBalance
值(想要下一条记录)。
其次,如果contro(txtAmountPaid)
在单击btnAddPayment
时不为空,或者在控件为0或为空时指定计算值,如何将焦点设置为下一条记录?
由于
答案 0 :(得分:0)
您是否尝试过记录集而不是(慢得多)dlookup?有点像...
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("select [EndBalance] from [Schedules] where [ScheduleID] = " & Form!Schedules!ScheduleID - 1)
If Not rs.EOF Then
Forms!Schedules!DblBegin = rs!EndBalance
End If
rs.Close
Set rs = Nothing
...第二个q:
If Not IsNull(Forms!Schedules!txtAmountPaid) then
DoCmd.GoToRecord , , acNext
Else
Forms!Schedules!Your_Field_Name = calculation_goes_here
End If