So I have two dates I need to calculate off a 'closing date' which is input by the user. The other two dates are 'Interest Starts' day and the 'First Payment' date. The 'closing date' is stored in a table called [doc_date].
So the first payment date I have already figured out. If the closing date is between the 1st and 10th it will just need to be the next month on the first. If the closing date is between 11th and the 24th it will need to be the next month on the 15th and finally if the closing date is affter the 24th it will need to be in two months on the first. I have the formula for that right here:
Code:
IIf(DatePart("d",[doc_date])>25,DateSerial(Year([doc_date]),Month([doc_date])+2,1),IIf(DatePart("d",[doc_date])<10,DateSerial(Year([doc_date]),Month([doc_date])+1,1),DateSerial(Year([doc_date]),Month([doc_date])+1,1)+14))
This seems to be working perfect. So then I started working on the 'interest starts' query field. If the closing date is between the 1st and 10th or 16th and 24th then the date stays the same. If it is between the 11th and 15th the date should just be the current month on the 15th. If the day is greater than the 24th it will be next month on the first. I thought I had this working, but its not working at all.
Code:
iif(((DatePart("d",[doc_date])>10)AND(DatePart("d",[doc_date])<15))or(DatePart("d",[doc_date])>25)),[doc_date],iif(DatePart("d",[doc_date])<10),DatePart("m",[doc_date])&"/15/"&DatePart("y",[doc_date]),iif(DatePart(m,DateSerial(Year([doc_date]),Month([doc_date]+1),1))&"/1/"&DatePart(y,DateSerial(Year([doc_date]),Month([doc_date]+1),1)),"Error")))
I have uploaded an xls with the correct dates corresponding to the closing date. https://docs.google.com/file/d/0B067...it?usp=sharing
I appreciate any help you can throw my way.