Results 1 to 4 of 4
  1. #1
    mphynson44 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    7

    DateDiff

    I have a business and I have cases for clients. Each case has a Due date and a completed date. I want to use the DateDiff expression to tell me how many of my cases exceeded their due date. So I wanted to use the DateDiff and then set a criteria of ">1" to represent all cases that went "past due".

    Any help would be greatly appreciated!

    Here is what I have so far:

    Click image for larger version. 

Name:	Query.jpg 
Views:	9 
Size:	47.0 KB 
ID:	15574

    TRANSFORM DateDiff("d",[Due Date],[Date Completed]) AS Expr2


    SELECT ClosedAdHoc.[Case Number], Count(ClosedAdHoc.[Case Number]) AS [Total Of Case Number]
    FROM ClosedAdHoc
    WHERE (((DatePart("yyyy",[Date Completed]))=2013))
    GROUP BY ClosedAdHoc.[Case Number]
    PIVOT Format([Date Completed],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,973
    What is the issue? Error message, wrong results, nothing?
    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
    mphynson44 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2013
    Posts
    7
    Thanks for the reply, sorry should have been more descriptive. Error, "You tried to execute a query that does not include the specified expression 'DateDiff..... as part of an aggregate function"

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,973
    A CROSSTAB requires 3 fields.

    Need a Value set to an aggregate function on the Total row.

    Change Group By under the DateDiff expression to Where and put >1 on the Criteria row.

    Pick some field (is there an ID) to do Count on and set as Value.
    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. DateDiff Help
    By iProRyan in forum Forms
    Replies: 1
    Last Post: 03-29-2012, 03:57 AM
  2. Datediff()
    By st1300 in forum Programming
    Replies: 6
    Last Post: 12-08-2011, 05:58 PM
  3. DateDiff
    By mrkaye in forum Forms
    Replies: 18
    Last Post: 11-19-2010, 08:19 AM
  4. DateDiff
    By ROB in forum Access
    Replies: 2
    Last Post: 10-30-2010, 03:58 AM
  5. Datediff
    By greggue in forum Queries
    Replies: 2
    Last Post: 08-13-2010, 03:53 PM

Tags for this Thread

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