
03-10-2006, 08:50 AM
|
|
Regular
|
|
Join Date: May 2004
Location: Ohio
Posts: 89
|
|
Date calculator
|
Hello,
I am trying to write a simple VB program in VB6 that displays the payoff date of a loan based on the number of payments that it will take.
Right now, I have the user input the balance owed on the loan, the payment amount that will be made each pay period (this payment amount will be the same amount for each payment on the life of the loan - ex. $25 per pay for the life of the loan), the payment frequency (either weekly, bi-weekly, or monthly), and the starting date.
I had no problems calculating the weekly and bi-weekly dates, but I do not know how to do the monthly date, since there are different days in each month. For my weekly and bi-weekly, I'm using the following code:
If cmbPaymentFrequency = "Weekly" Then
txtPayoffDate = temp + ((numPayments - 1) * 7)
ElseIf cmbPaymentFrequency = "Bi-Weekly" Then
txtPayoffDate = temp + ((numPayments - 1) * 14)
The variable 'temp' is defined as: temp = CDate(txtStartingDate) So it is storing the date entered in by the user in a date data type instead of a string data type.
Obviously I can not use the same format for the monthly payoff since there are different days in each month. Is there a way that if my program has a starting date of 3/15/2006 and it will take 4 payments to pay off the loan, that the payoff date will display 6/15/2006? The payment day for monthly payments would be the same day of every month.
Thanks in advance for any help that anyone can provide. I appreciate it!
|
|