Assuming that you have a table that holds the parameter of the loan say
"tblLoans" Linked to tblSchedule on Loan_ID (one-To-Many)
You can (or really should !) create the repayment schedule when the loan is
created.
something Like this
Here we go:
Private Sub CreateScheduleButton_Click( )
'Output: Create a loan repayments Monthly schedule
Dim idLoan as Long, _
Dim tmpDate As Date, _
numPayments As Long, _
perAmount As Double, _
PayNum As Long, _
rs As DAO.Recordset
'*** Requires DAO Object library reference
'variables:
'-----------
'idLoan: Loan_ID
'tmpDate: Scheduled Paymenet date
'numPayments: Number repayments
'perAmount: Periodical (repayment) Amount
'PayNum: Payment number (secquential number)
'Read Master Loan Master Table ----
idLoan=Nz(Me.Loan_ID,0) ' or However you get the Loan_ID
tmpDate = Nz(DLookup("[First Repayment]", _
"tblLoans", "[Loan_ID]=" & idLoan), Date)
numPayments = Nz(DLookup("[Num Repayments]", _
"tblLoans", "[Loan_ID]=" & idLoan), 0)
perAmount = Nz(DLookup("[Period Amount]", _
"tblLoans", "[Loan_ID]=" & idLoan), 0)
If idLoan = 0 Or _
numPayments = 0 Or _
perAmount = 0 Then
Exit Sub
End If
'Open the recordset
Set rs = CurrentDb.OpenRecordset("tblSchedule")
'Append the schedule
For PayNum = 1 To numPayments
With rs
.AddNew
![Loan_ID] = idLoan
![Repayment No] = PayNum
![Due Date] = tmpDate
![Amount Due] = perAmount
.Update
End With
'Move to next month
tmpDate = DateAdd("m", 1, tmpDate)
Next PayNum
' Close the recordset ---
rs.Close
Set rs = Nothing
'--- tell the user it is done
MsgBox "Schedule created with " & numPayments & " Repayments"
End Sub
++++++++
Disable the Button once the shcedule was created
Regards/JK
"Levans digital" <(E-Mail Removed)> wrote in message
news:CE2EA754-CBF5-4CC2-8D7A-(E-Mail Removed)...
> Hey all,
> I am trying to set up a billing template. Like for example what a Bank
> would
> use.
> Scenario: lets say a Loan Payment is $450 per month due the 15th of each
> month.
> I would like the table to be setup like this:
>
> Fiellds: Due Date Amout Due Pay Date Amount Paid
> record1 10/15/2006 $450 10/14/2006 $450
> record2 11/15/2006 $450
>
> What I want to accomplish: What can I do to have the Next Due Date and the
> Amount Due be automatically entered into the table as in Record 2.
>
> Thanks Very Much
>
|