Results 1 to 4 of 4
  1. #1
    joey is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2014
    Posts
    7

    Query that returns LAST date IF Last date is more than 30 days ago

    Hi,
    We have service reps that call on stores to service the display racks. I need a report that shows all stores that have not been serviced in the last 30 days and the result should only show the Last service date (one record) for that store.



    Table Fields are:
    • Service Rep
    • Store Name
    • Service Date

    Thank you!
    Joey

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Not LAST, but Max. For each store you want the Max (ServiceDate).

  3. #3
    joey is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2014
    Posts
    7
    Thank you - that worked and it returns the last service date for each store.
    I now need that to be as of 30 days ago - meaning if there was no service for the last 30 days then that store (with service date) should be in the result. If there was a service within that last 30 days then it shoul not be in the result. Thank you!

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Where datediff("d",Date, Max(ServiceDate)) >30

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-28-2014, 01:02 PM
  2. Replies: 1
    Last Post: 11-26-2013, 09:25 AM
  3. Replies: 1
    Last Post: 02-12-2013, 03:48 AM
  4. Replies: 7
    Last Post: 01-28-2013, 05:21 PM
  5. Replies: 2
    Last Post: 07-31-2009, 06:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums