Results 1 to 3 of 3
  1. #1
    Slush is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    38

    count total calls placed on weekdays, evenings, and saturdays


    Hello,
    I need to count the total number of contacts occurring on weekdays (before 6 pm), weekday evenings (after 6), or Saturdays. Basically, every person must have 3 weekday calls, 1 evening and 1 Saturday. Below is a portion of the code I used successfully previously in Access, but now I am trying to use it with a SQL Server back end and I can't get it to work. I get an error when trying to calculate the weekday call portion: Sum(Abs(Weekday([ContactDate])<>7)) AS WkDay.

    How do I count total phone calls by day of week and time with a SQL Server back end?


    SELECT Main.PatID, Sum(Abs(Weekday([ContactDate])<>7)) AS WkDay
    FROM Main INNER JOIN Contact ON Main.PatID = Contact.PatID
    WHERE (((Contact.CONTACTTYPE)>199 And (Contact.CONTACTTYPE)<999) AND ((TimeValue([Contact].[contactdate]))<#12/30/1899 18:0:0#))
    GROUP BY Main.PatID;

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    In the base query Q1,pull your data and add the DOW field, format([contactdate],"w")
    then count the weekdays in Q2 (using Q1)

  3. #3
    Slush is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2016
    Posts
    38
    So simple. Works great. Thank you!!

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

Similar Threads

  1. total calls per hour
    By desireemm1 in forum Reports
    Replies: 11
    Last Post: 10-28-2014, 03:29 PM
  2. Replies: 2
    Last Post: 04-15-2014, 01:59 PM
  3. Total divided by weekdays in a month
    By normie in forum Access
    Replies: 1
    Last Post: 03-22-2012, 07:09 PM
  4. Intervening Saturdays / Sundays
    By Alex Motilal in forum Programming
    Replies: 2
    Last Post: 10-02-2011, 01:00 AM
  5. total Count
    By Alaska1 in forum Access
    Replies: 2
    Last Post: 12-06-2010, 08:09 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