SImple Query question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devagupt
    New Member
    • Oct 2006
    • 12

    #1

    SImple Query question

    I have a question .
    I have a Chart which i run from a query. The chart has 3 fields
    Line , Date , Time in mins. The purpose of the chart is to display the sum of all the "time in mins" in a given "line" for a week( from date to date).
    In the query i am trying to sum all the "time in mins" for a given line and display it as a sum. How should i do that?The query should also have the date, sum of time in mins for a given line. This info needs to be on a chart .
    This is probably a easy question but i dont know how to go about it.
    Thanks.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    I've never come across Charts in Access before.
    In a report, though, textBoxes have a 'Running Sum' property which can be used to maintain a running total of records so far. Alternatively, you could have a TextBox in the Footer section which ontains "=Sum([Field])" in its Control Source property.

    Comment

    • devagupt
      New Member
      • Oct 2006
      • 12

      #3
      is there a running sum in a query?
      I need to sum all the Time in mins in a given line. So i need to group by line and then sum all time in mins in a line so when i run the query it shows the line i typed in a query and the sum of all time in mins of that particular line which is stored in different recorsd. i hope i was clear

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Not very clear I'm afraid.
        However, I can say that - No, there is not a running sum facility in queries. Only in objects built on them (at least there is in a report - I couldn't find anything in a form)

        Comment

        • devagupt
          New Member
          • Oct 2006
          • 12

          #5
          I have 6 fields. They are
          Date, Line, Shift, Downtime in mins, DOwntime comments and Type of downtime.
          I want to write a query which will show me The accumulated downtime in mins for all the shifts in a given line for a week. Can i do this?



          Originally posted by NeoPa
          Not very clear I'm afraid.
          However, I can say that - No, there is not a running sum facility in queries. Only in objects built on them (at least there is in a report - I couldn't find anything in a form)

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Yes.

            Something like :-
            Code:
            SELECT Format([Date], 'ww') AS Week, [Line], [Shift], Sum([Downtime]) AS WeeklyDowntime
            FROM [Table1]
            ORDER BY Format([Date], 'ww'), [Line], [Shift]
            GROUP BY Format([Date], 'ww'), [Line], [Shift];
            should do you.

            Comment

            Working...