Results 1 to 4 of 4
  1. #1
    Hello1 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    32

    How to convert time into speed?

    Couldnt think of a better title for the thread. However, I need help in next case.


    I made a query "qryResults" which contains some results about races (in the screens is the smaller version of it). I have 3 fields, the length of the race track in kilometers, driving time in minutes (its the drivers time which he needed to finish the race) and the calculated field average speed of the driver during the race the calculation you can see on the screens i attached. Anyhow, it works fine but the problem is that I want the field "DrivingTime" to be more detailed. Instead only minutes to be written something like 01:31:54. I tried to make that field date/time and have put the format to be "long time" but the calculation doesn't work then, well guess date/time isn't meant for that anyway. Tried for a while now but just cant figure it out :/
    If anyone has an idea (guess here math needed more ) please share, thanks!
    Attached Thumbnails Attached Thumbnails 7.PNG   8.PNG  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Converting minutes to a clock time display is actually a string result, not a date/time value.

    Bing: Access convert minutes to hours and minutes

    https://bytes.com/topic/access/answe...-access-2000-a
    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
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    I have a function to do this,

    Code:
       'USAGE:  ElapsedTimeAsDate(655)
    
    Public Function ElapsedTimeAsDate(ByVal pvSecs)
    Dim vTxt, vHr, vMin, vSec
    Dim iNum As Long
    
    '60 sec = 1 min  60 sec
    '60 min = 1 hr 3600 sec
    
      'hrs
    iNum = pvSecs \ 3600
    if inum > 0 then
        vHr = format(iNum,"00")
        pvSecs = pvsecs - (inum * 3600)
    end if
        
       'mins
    iNum = pvSecs \ 60
    if inum > 0 then
        vMin = format(iNum,"00")
        pvSecs = pvsecs - (inum * 60)
    end if
    
    vSec =  pvSecs 
    ElapsedTimeAsDate= vHr & ":" & vmin & ":" & vsec
    End Function

  4. #4
    Hello1 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    32
    Hey June thanks!
    However, I found something else, and it works just like I want it.

    Edit: just saw your post after posting mine ranman, thanks but im not yet into programming. Will definitely check it when i get spare time. Thanks again guys.
    Click image for larger version. 

Name:	9.PNG 
Views:	15 
Size:	37.2 KB 
ID:	23127Click image for larger version. 

Name:	10.PNG 
Views:	15 
Size:	9.2 KB 
ID:	23128

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

Similar Threads

  1. Replies: 1
    Last Post: 08-12-2014, 09:48 PM
  2. Convert Number to Date/Time
    By Jerseynjphillypa in forum Queries
    Replies: 10
    Last Post: 06-13-2012, 12:33 PM
  3. Convert time stamp Now() to Fiscal Year
    By ajcke in forum Queries
    Replies: 17
    Last Post: 05-17-2012, 12:51 PM
  4. Convert finishing time to position
    By Mantaii in forum Queries
    Replies: 5
    Last Post: 11-02-2011, 04:52 AM
  5. Convert local time to UTC
    By zapper222 in forum Programming
    Replies: 0
    Last Post: 08-01-2010, 03:01 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