Results 1 to 2 of 2
  1. #1
    duddu is offline Novice
    Windows 8 Access 2016
    Join Date
    Jun 2017
    Posts
    13

    Access form

    SELECT CS.[Agent Name], Count(CS.Score) AS CountOfScore
    FROM CS
    WHERE (((CS.Score)<85)) AND (DatePart("w",Now()) AS now, Now()-DatePart("w",Now()) AS lastsaturday, Now()-DatePart("w",Now())-6 AS lastsaturdaybeforesunday)


    GROUP BY CS.[Agent Name];


    Hi, I’m trying to display only 7 day data from table. But I’m getting error while doing this please help me.

    Thanks.


    Sent from my iPhone using Tapatalk

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    It would help if you told us what the error is. However, "as Now" might be causing an error because you can't use the "now" as an alias - it is the name of a function. Change "Now" to "RightNow" or something like that.

    More importantly, I know this is wrong:
    (DatePart("w",Now()) AS now, Now()-DatePart("w",Now()) AS lastsaturday, Now()-DatePart("w",Now())-6 AS lastsaturdaybeforesunday)

    It evaluates to 3 values inside brackets and separated by commas: (Integer as now, Date1 AS lastsaturday , Date2 AS lastsaturdaybeforesunday). This "expression" is meaningless. What is it you want that WHERE clause to say, i.e. CS.Score < 85 AND ????. ANS what - in plain English.

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

Similar Threads

  1. Replies: 3
    Last Post: 06-24-2017, 06:39 PM
  2. Replies: 3
    Last Post: 07-07-2014, 07:08 AM
  3. Replies: 16
    Last Post: 05-04-2014, 09:19 AM
  4. Replies: 1
    Last Post: 07-01-2013, 09:46 AM
  5. Replies: 6
    Last Post: 12-03-2012, 05:28 PM

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