Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DateAdd in a query to find records of a certain age.

Status
Not open for further replies.

davidrsutton

Programmer
Oct 6, 2004
94
GB
Hi...

I am writing a database that keeps track of Staff members and their contracts etc. There is a screen in the system that shows the names of people whose details are still on the system, although they left the company over 3 months ago. The purpose of this is so that we keep all old staff details on file for 3 months 'just in case' then delete them, and this page is to flag up people whose records can now be deleted (becasue they've been gone for more than 3 months).

Now, there is a date field on the form FrmStaff where we record what date they left the company, so basically, I want to pull records from tblStaff where tblStaff.LeftDate is more than 90 days in the past.

I have got queries that pull out records if a certain date (ADRDate) is less than 90 days away in the future, but I can't turn it round so that it picks up dates more than 90 days in the past. This is what I am using in the date field criteria to pick out records that are less than 90 days away in the future: <DateAdd("y",90,Now())
and that works fine... I assumed you just had to change the < to a > and it would work but no....

Any help would be greatly appreciated.

Dave.

 
And what about this ?
< Date() - 90

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV...

What can I say... you're the boss!!!!

Cheers Mate,

Dave.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top