How to update a date field based off of another date + x amount of months?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • David Snyder

    How to update a date field based off of another date + x amount of months?

    I have a date that is used to show when someone completed a task and the task is due again in 12,24,48 months. I am trying to update a field for the next due date. Of course after I get this done, I will build a query report to show anyone that is going to be due again in the next 30 days.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    If OldDate is the date completed, and NewDate is the date due again:

    Code:
    NewDate=DateSerial(Year(OldDate)+1,DateSerial(Month(OldDate),Day(OldDate))
    The +1 is for 12 months.

    You will have to add some logic to check that the due date does not fall on an illegal date, like Feb 29 in a year that is not a leap year. Or just force all due dates to be the first or last day of a month my changing the Day parameter in the DateSerial function.

    Jim

    Comment

    • David Snyder

      #3
      Thanks Jim (more info please.

      Ok.. so I have the formula to get the "Due" date, but it does not update the field in the table. It will show on the form, but it does not carry over into the table.

      Comment

      • jimatqsi
        Moderator Top Contributor
        • Oct 2006
        • 1293

        #4
        You're going to have to fill in some details. What event is triggering the calculation of the due date? Is your due date text box bound to the relevant data item? Show us some code.

        Jim

        Comment

        Working...