Find records with date more than xx months

  • Thread starter Thread starter James
  • Start date Start date
J

James

Assume we have a table listing serial number (of a widget) and a date.

The date is the date of service.

How can we then, produce a query/report listing all widgets that have not
been services within the last 12 months?

Are we approching this wrongs? Should we have a fixed field showing date
next service due? How can this be calculated from the data in the table?
 
Create a query based on that table, and add a calculated field to the query.
Your calculation would be something like:

MonthsSinceLastService: DateDiff("m", [LastServiceDate], Date())

Put > 12 as the criteria under that field.
 
You will want to use the datadiff function

MonthsSinceService: datediff("m",[lastservice],now())
then select records with a MonthsSinceService >=12

Ed Warren
 
Calculated fields is the way to do. All you need is a text box or row in
query with source something thing like:

=[Datefield]+365

Then you can run querys on this field, call it [nextservice] like:

Where [Nextservice]<Date()

This will return all widgets past thier service date.

HTH

Rico
 

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

Back
Top