Update Date value to current year

  • Thread starter Thread starter helpmeplease
  • Start date Start date
H

helpmeplease

How do I update the "Hire Date" date value to the current year or the next
year if the "Hire Date" is less then 365 days old to be shown as an
evaluation due date?
 
Try this --
Evaluation_Due_Date: IIf([Hire
Date]<Date()-365,DateSerial(Year(Date()),Month([Hire Date]),Day([Hire
Date])),DateSerial(Year(Date())+1,Month([Hire Date]),Day([Hire Date])))
 
How do I update the "Hire Date" date value to the current year or the next
year if the "Hire Date" is less then 365 days old to be shown as an
evaluation due date?
DateAdd() is your friend here.

Dateadd("yyyy",1,hiredate) will turn oct. 21st, 2009 to oct. 21st 2010

That is what you update your field to. You can put a negative # in
DateAdd, (and it subtracts) in order to determine whether a date of more
or less then 265days form another date.

IIf([Hiredate]>Dateadd("d",-365,[DueDate]),
Dateadd("yyyy",1,[hiredate]), [[hiredate]])

would add a year to anything less then a year different.

These are just ideas, how you implement it is up to you, but DateAdd()
is the key.

Phil
 
How do I update the "Hire Date" date value to the current year or the next
year if the "Hire Date" is less then 365 days old to be shown as an
evaluation due date?

Karl and Phil have given you the answer... but you should probably NOT
actually update (permanently overwrite and replace) the employee's hire date!
You can dynamically calculate the evaluation duedate in a query:

DueDate: DateAdd("yyyy", 1, [Hire Date])

and use criteria on this field such as

BETWEEN Date() AND DateAdd("d", 7, Date())

to find employees whose evaluations are due in the next week.
 
Back
Top