Update Date value to current year

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?
 
K

KARL DEWEY

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])))
 
P

Phil Smith

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
 
J

John W. Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top