Date criteria

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

Guest

I have a query with two fields; a PC ID number, and the date it last backed
up. I want the query to return any PC that hasn't backed up in the past 7
days. How would I go about this?
 
Write into Criteria in a query this:
<=Now()-7
The date field should have Date format.

By, Mirek.
 
Thanks, works perfectly.

Actually, it may not be working quite as you expected.
Now() carries a Time as well as a Date value.
If your records also have the Time value as well as the date value
stored, then using >=Now()-7 will not return records of seven days ago
written earlier than the time of day you run the query, i.e. run the
query at noon and you will not return records written before noon 7
days ago, run it at 4:00 PM an you will not return records written
before 4:00 PM seven days ago.

Always use Date() to enter data as well as searching for records if
the Time value is not needed ( >=Date()-7)
 
Back
Top