Hi Richrard I Create Loan Amotization Db by fowlloing you and I type vb code as yors bellow Option Compare Database Option Explicit
Private Sub Command36_Click()
CreatePayments
End Sub
Private Sub CreatePayments()
' CHECK FOR EXISTING PAYMENT FIRST!!!!!!
Dim StartDate As Date StartDate = InputBox("Start Date", , Date)
Dim db As Database Dim rs As Recordsets
Set db = CurrentDb Set rs = db.OpenRecordset("LoanPaymentT")
Dim X For X = 1 To NumberOfMonths rs.AddNew rs!LoanID = LoanID rs!Paymentdate = StartDate StartDate = DateAdd("m", 1, StartDate) rs!paymentamount = MonthlyPayment rs.Update Next
rs.Close db.Close Set rs = Nothing Set db = Nothing
Me.Requery
End Sub But I got this Error Compile Error: Variable not Defined
Reply from Richard Rost:
Which variable is not defined? Does the debugger stop on a specific line. Remember, if you have the line "option explicit" at the top of your VBA window, you HAVE to DIM each of your variable.s
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Microsoft Access 324.