0

我正在使用 制定贷款摊销计划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)单击 abtnRepaymentSchedule挑战是当我单击 a 时btnAddPaymentsbfSchedules我希望该dblEnd字段的值是下一个记录dblBegin字段的值!我试过使用

dlookup(txtBeginBalance = Dlookup("EndBalance", _
    "Schedules","[ScheduleID] = Form![Schedules]![ScheduleID]-1) 

但没有效果,但如果我使用

txtBeginBalance = txtEndBalance 

的值txtEndBalance被分配给txtBeginBalance同一记录的值(想要下一条记录)。

contro(txtAmountPaid)其次,如果在控件为 0 或 null 时单击btnAddPayment或分配计算值时 a不为空,我如何将焦点设置到下一条记录?

谢谢

4

1 回答 1

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
于 2013-11-02T09:43:43.283 回答