Results 1 to 4 of 4

Thread: Access Sum Statement when using Time (RESOLVED)

  1. #1

    Thread Starter
    Frenzied Member Robbo's Avatar
    Join Date
    Jan 2001
    Location
    Bradford
    Posts
    1,143

    Resolved Access Sum Statement when using Time (RESOLVED)

    Had a look searching for this but not really what i wanted

    have this

    SELECT *
    FROM Production
    WHERE Production.Line = 'D4'
    AND Production.Shift = 'B'
    AND Production.Date = #07/13/04#;

    displays

    Run Time
    01:45
    03:30
    03:05
    01:20
    00:45

    however when run

    SELECT SUM([run time]) AS ["Run Time"]
    FROM Production
    WHERE Production.Line = 'D4'
    AND Production.Shift = 'B'
    AND Production.Date = #07/13/04#;

    it displays

    """Run Time"""
    0.434027777777778

    so i think the formating of the result needs doing but how do i do this in access?? any help please thanks in advance

    would be greatful

    put this into excel and the numbers added up give the 0.43 but want to add as time, not a number, any help thanks
    Last edited by Hack; Jun 7th, 2006 at 08:57 AM. Reason: Added green "resolved" checkmark Last edited by Robbo : Today at 09:51 AM.
    -----------------------------------------------
    "The hall is rented,"
    "the orchestra is engaged,"
    "its now time to see if you can dance!"
    Q, Q-Who, Star Trek The Next Generation
    -----------------------------------------------
    General Work day

    -----------------------------------------------
    DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Access Sum Statement when using Time

    Try this amendment:
    Code:
    SELECT Format(SUM([run time]),"hh:nn") AS ["Run Time"]
    ...
    As dates/times are stored as numerics internally (the Integer part is the date), this should work nicely.

  3. #3
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872

    Re: Access Sum Statement when using Time

    try this

    SELECT cdate(SUM([run time])) AS ["Run Time"]
    FROM Production
    WHERE Production.Line = 'D4'
    AND Production.Shift = 'B'
    AND Production.Date = #07/13/04#;

  4. #4

    Thread Starter
    Frenzied Member Robbo's Avatar
    Join Date
    Jan 2001
    Location
    Bradford
    Posts
    1,143

    Re: Access Sum Statement when using Time

    Quote Originally Posted by si_the_geek
    Try this amendment:
    Code:
    SELECT Format(SUM([run time]),"hh:nn") AS ["Run Time"]
    ...
    As dates/times are stored as numerics internally (the Integer part is the date), this should work nicely.
    thats it great thanks very much, knew wasnt far off, cheers
    -----------------------------------------------
    "The hall is rented,"
    "the orchestra is engaged,"
    "its now time to see if you can dance!"
    Q, Q-Who, Star Trek The Next Generation
    -----------------------------------------------
    General Work day

    -----------------------------------------------
    DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width