Results 1 to 3 of 3
  1. #1
    abodi is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    31

    Query by time while suming another column

    Hi Everyone,



    I've got what i hope to be a simple problem but my google-fu seems weak against it.

    i've got a table that contains

    Name | Date | Hours off

    What i want to be able to do is do a seach within a date range and then total the hours off for each person.

    i can do that date range easy and i can do the total when i'm not including date range.

    TESTING_All Staff Total
    Name SumOfHours off today
    A.L 15.2
    A.R 7.6
    A.S 7.6
    A.H 7.6

    But i can't do them together, it does try to sum up the hours but will sum it for each person for a particular date, whereas i want to query by date, but i dont' want the data to be separated by day.

    TESTING_All Staff Total
    Name SumOfHours off TodayDate
    A.L 7.6 20/09/2011
    A.L 7.6 27/09/2011
    A.R 7.6 26/09/2011
    A.S 7.6 27/09/2011
    A.H 7.6 26/09/2011



    so essentially i want the data to show as per the first table shown, but i want to be able to enter the date range to show. that way i could total for day, week, month, or whatever date range you put in.

    Thanks in advance, you guys are always so helpful.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It would have helped to see the SQL of the query, but it sounds like you have Group By on the date field, and it should be Where.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    abodi is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    31
    pbaldy you were absolutely right.

    i have come across another issue though.


    in the DATE field,

    If its left with no conditions but set to "where" : It works

    if i set the condition to "Between [s1] and [s2]" : It works (when run it asks for a date and it works)

    if i set the condition to "Between [Forms]![View_Data]![StartDate4] And [Forms]![View_Data]![EndDate4]" : it DOESN'T work, just returns no data.

    now the confusing part to me, is if i get rid of the summing, and just search via the date range as per my form, it works.


    To clarify, the date range fields works and are well tested.
    when i enter the date via a popup (because it's not linked to a form) it works.
    it does not however work when both are combined. the query runs but returns no data.

    any ideas?


    heres a pic, i coudln't seems resize once embedded.

    https://picasaweb.google.com/lh/phot...eat=directlink
    Last edited by abodi; 09-28-2011 at 08:02 PM. Reason: change

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

Similar Threads

  1. Replies: 1
    Last Post: 08-18-2011, 08:35 AM
  2. Replies: 7
    Last Post: 04-27-2010, 02:47 PM
  3. Replies: 1
    Last Post: 04-15-2010, 02:07 AM
  4. Add new column in a select query
    By ysrini in forum Queries
    Replies: 3
    Last Post: 02-03-2010, 06:58 AM
  5. Suming Positive Numbers Only
    By jbarrum in forum Access
    Replies: 5
    Last Post: 04-24-2009, 03:51 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