Extracting Month and day from Date field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a query based upon the anniversay of employee hire dates.

Records should be limited to only those employees with anniversaries within
the next 60 days, so we can do annual reviews. How to I create another field
in a query that extracts just the month & date from the DateHired, and search
that field to see if the month and date are within 60 days from the current
date.
 
Williams said:
I need to create a query based upon the anniversay of employee hire dates.

Records should be limited to only those employees with anniversaries within
the next 60 days, so we can do annual reviews. How to I create another field
in a query that extracts just the month & date from the DateHired, and search
that field to see if the month and date are within 60 days from the current
date.


Several ways to do that. A relatively simple way is to use
a calculated field:

MonDay: Format(annivdate, "mmdd")

and the criteria would then be:

Between Format(Date(), "mmdd") And Format(DateAdd("d", 60,
Date(), "mmdd"))
 
Try the following

Field: DateSerial(Year(Date()),Month(DateHired),Day(DateHired))
Criteria: Between Date() and DateAdd("d",60, Date()) OR Between
DateAdd("yyyy",-1,Date()) AND
DateSerial(Year(Date())-1,Month(Date()),Day(Date())+60)

You need the second part of the criteria to catch those whose DateHired is
in the last 60 days of the year
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top