Need Help with Date Coding

  • Thread starter Thread starter Rgomez1999
  • Start date Start date
R

Rgomez1999

Guest
Problem #1

If HRAEnrollDate < #5/1/1999# Then
FirstProgressDate = DateAdd("m", 6, [HRAEnrollDate])
End If

I need this statement to automatically enter a [reportduedate] to the month of December 1999 if any date was before 5/1/1999. Example: If admitted 3/25/1994 it will automatically go to 12/25/1999.
What is the proper code for this function I need to add to this.
--------------------------------------------------------------------------------
Problem #2

If HRAEnrollDate > #12/31/1999# Then
FirstProgressDate = DateAdd("m", 3, [HRAEnrollDate])

I need this statement to go to the [NextProgressReport] every three months field and add an aditional three months to it, and every three months afterwards. Example: Admitted 2/15/2000 [firstprogressdate] due 5/15/2000 and [nextprogressreport] due 8/15/2000 and so on to 11/15/2000, etc.

Is there a loop function I can use for this? If so, what is the proper code for this function?

once I solve this, this two week project that has caused me gray hair will finally be over.
Thank you everyone for their past support.
 
Try this Prob # 1

Public Function changeDate(ByVal dDate As Date) As Date

If dDate < #5/1/1999# Then
changeDate = CDate("12/" & DatePart("d", dDate) & "/1999")
Else
changeDate = dDate
End If


End Function
 

Users who are viewing this thread

Back
Top Bottom