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 as of 30 days ago

    The last date in the query works fine but when I add the criteria Date()-30 it will only return one date (the most recent).

    The project is to group stores that have not been serviced within the last 30 days and only to return the last service date.


    Thanks Joey

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Post the SQL statement of the query.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    joey is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2014
    Posts
    7
    Here is the SQL statement that returns the most recent service date for each store. What I need for the report is "IF there is no service date within the last Then return the last service date".
    Thank you.

    SELECT [Store Service LOG - Master Query].[Store Service LOG].Cust_Lookup.Value, [Store Service LOG - Master Query].[Store Service LOG].[Field Rep Name], Max([Store Service LOG - Master Query].[Store Service LOG].[Service Date]) AS [MaxOfStore Service LOG_Service Date]
    FROM [Store Service LOG - Master Query]
    GROUP BY [Store Service LOG - Master Query].[Store Service LOG].Cust_Lookup.Value, [Store Service LOG - Master Query].[Store Service LOG].[Field Rep Name]
    ORDER BY [Store Service LOG - Master Query].[Store Service LOG].[Field Rep Name];

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    "IF there is no service date within the last [30 days] Then return the last service date" is essentially just returning the most recent service date regardless of when it took place.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Date Range Query Only Returns Month and Day
    By hammer187 in forum Queries
    Replies: 5
    Last Post: 09-18-2012, 11:25 AM
  2. Replies: 2
    Last Post: 10-08-2011, 06:33 PM
  3. Run Query based on date for Multiple days
    By jedwards85 in forum Access
    Replies: 3
    Last Post: 03-29-2011, 12:04 PM
  4. Replies: 1
    Last Post: 11-12-2010, 01:16 AM
  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