Results 1 to 4 of 4
  1. #1
    jtmurphy is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    2

    Using BETWEEN in variable entries

    Hello all,

    I have a number of call agents with different hire dates, I would like to know how many calls each of them accepted in their first month, second month, etc. I can get their total number of calls accepted but get stuck at that point. Here's my query at this time:

    SELECT PhoneData.[CL Username], AgentRoster.[Hire Date], AgentRoster.[Hire Date]+30, SUM(PhoneData.Accepted)
    FROM PhoneData, AgentRoster
    WHERE AgentRoster.[CL Username]=PhoneData.[CL Username]


    GROUP BY PhoneData.[CL Username], AgentRoster.[Hire Date], AgentRoster.[Hire Date]+30

    Is BETWEEN the right way to go, or is there an option I'm not thinking of. Any help would be greatly appreciated, thanks!

    John

  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
    53,640
    So you need to group by agent and month? Maybe:

    SELECT PhoneData.[CL Username], Format([CallDate], "yyyymm") AS YrMo, SUM(PhoneData.Accepted)
    FROM PhoneData, AgentRoster
    INNER JOIN AgentRoster.[CL Username]=PhoneData.[CL Username]
    GROUP BY PhoneData.[CL Username], Format([CallDate], "yyyymm");
    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
    jtmurphy is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    2

    It's the different hire dates that's causing trouble

    So you need to group by agent and month? Maybe:

    SELECT PhoneData.[CL Username], Format([CallDate], "yyyymm") AS YrMo, SUM(PhoneData.Accepted)
    FROM PhoneData, AgentRoster
    INNER JOIN AgentRoster.[CL Username]=PhoneData.[CL Username]
    GROUP BY PhoneData.[CL Username], Format([CallDate], "yyyymm");[/QUOTE]

    The trouble I'm having is how to grab only the first month's data with varying hire dates. For example,

    Agent #1 - 5/1/14 (just want the data from 5/1 - 6/1)
    Agent #2 - 6/15/14 (just want the data from 6/15 - 7/15)
    Agent #3 - 11/10/13 (just want the data from 11/10 - 12/10)

    Is there a way to distinguish that in a query? Or will I just have to set up a query for each class?

  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
    53,640
    Maybe:

    WHERE Format([CallDate], "yyyymm") = Format([HireDate], "yyyymm")
    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. Replies: 11
    Last Post: 03-13-2014, 09:54 AM
  2. Replies: 3
    Last Post: 05-28-2013, 12:53 PM
  3. Object variable or With block variable not defined
    By PorscheMan in forum Programming
    Replies: 3
    Last Post: 01-16-2013, 01:53 PM
  4. Replies: 0
    Last Post: 08-10-2011, 11:59 AM
  5. Refering to variable form names inside a variable
    By redpetfran in forum Programming
    Replies: 2
    Last Post: 05-21-2010, 01:39 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