What should the date be if the loan start date is the first of the month ie 2/1/2016 or 3/1/2016?
This function seems to work
Code:
Function FirstPayment(pInputDate As Date)
' Return a date that is the first day of the month of the date passed
Dim d As Integer, M As Integer, Y As Integer
Dim mths As Integer
mths = 2
If IsNull(pInputDate) Then
FirstPayment = Null
Else
'sets the number of months
mths = mths + (Day(pInputDate) = 1)
d = Day(pInputDate)
M = Month(pInputDate)
Y = Year(pInputDate)
FirstPayment = DateSerial(Y, M + mths, 1)
End If
End Function
In the immediate window, I get this
Code:
? FirstPayment(#2/15/2016#) <- enter this
4/1/2016 <--returns this
Usage would be for a control
= FirstPayment([LoanStartDate])
In a query PmntDate: FirstPayment([LoanStartDate])